Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
package_manager_funnelback.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/package_manager.inc';
18 
32 {
33 
34 
40  {
41  $this->_full_path = SQ_PACKAGES_PATH.'/funnelback';
42  $this->Package_Manager();
43 
44  }//end constructor
45 
46 
56  {
57  $system_assets = Array(
58  'funnelback_manager',
59  'cron_job_funnelback_log_rotation',
60  );
61  $installed_assets = Array();
62 
63  foreach ($system_assets as $type_code) {
64  if ($GLOBALS['SQ_SYSTEM']->am->installed($type_code)) {
65  $installed_assets[] = $type_code;
66  }
67  }
68 
69  return $installed_assets;
70 
71  }//end getSystemAssetTypes()
72 
73 
81  {
82  $system_management_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('system_management_folder');
83 
84  $GLOBALS['SQ_SYSTEM']->am->includeAsset('funnelback_manager');
85  $funnelback_manager = new Funnelback_Manager();
86  $funnelback_manager_link = Array('asset' => &$system_management_folder, 'link_type' => SQ_LINK_TYPE_1, 'is_exclusive' => 1);
87  if (!$funnelback_manager->create($funnelback_manager_link)) {
88  trigger_localised_error('FNB0010', E_USER_ERROR);
89  }
90  pre_echo('Funnelback Manager Asset Id : '.$funnelback_manager->id);
91 
92  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('funnelback_manager', $funnelback_manager->id);
93 
94  return $funnelback_manager;
95 
96  }//end createFunnelbackManager()
97 
98 
106  {
107  $cron_manager = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('cron_manager');
108  if (is_null($cron_manager)) {
109  trigger_error('Couldn\'t get cron manager, couldn\'t create Funnelback Log Rotation cron job', E_USER_WARNING);
110  $null = NULL;
111  return $null;
112  }
113 
114  $GLOBALS['SQ_SYSTEM']->am->includeAsset('cron_job_funnelback_log_rotation');
115 
116  $cron_job = new Cron_Job_Funnelback_Log_Rotation();
117  $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
118  if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
119  trigger_error('Funnelback Log Rotation Cron Job NOT CREATED', E_USER_ERROR);
120  }
121  pre_echo('Funnelback Log Rotation Cron Job Id: '.$cron_job->id);
122 
123  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('cron_job_funnelback_log_rotation', $cron_job->id);
124 
125  return $cron_job;
126 
127  }//end createCronJobFunnelbackLogRotation()
128 
129 
130 }//end class
131 
132 ?>