Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
package_manager_squiz_suite.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/package_manager.inc';
18 
32 {
33 
34 
40  {
41  $this->_full_path = SQ_PACKAGES_PATH.'/squiz_suite';
42  $this->Package_Manager();
43 
44  }//end constructor
45 
46 
56  {
57  $system_assets = Array(
58  'suite_manager',
59  'cron_job_sync_suite_products',
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 
80  function &createSuiteManager()
81  {
82  $web_services_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('web_folder_web_services');
83 
84  $GLOBALS['SQ_SYSTEM']->am->includeAsset('suite_manager');
85  $suite_manager = new Suite_Manager();
86  $suite_manager->setAttrValue('name', 'Squiz Suite Manager');
87  $suite_manager_link = Array('asset' => &$web_services_folder, 'link_type' => SQ_LINK_TYPE_1, 'is_exclusive' => 1);
88  if (!$suite_manager->create($suite_manager_link)) {
89  trigger_localised_error('SQS0001', E_USER_ERROR);
90  }
91  pre_echo('Squiz Suite Manager Asset Id : '.$suite_manager->id);
92 
93  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('suite_manager', $suite_manager->id);
94 
95  return $suite_manager;
96 
97  }//end createSuiteManager()
98 
99 
107  {
108  $cron_manager = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('cron_manager');
109  if (is_null($cron_manager)) {
110  trigger_error('Couldn\'t get cron manager, couldn\'t create Sync Squiz Suite Products cron job', E_USER_WARNING);
111  $null = NULL;
112  return $null;
113  }
114 
115  $GLOBALS['SQ_SYSTEM']->am->includeAsset('cron_job_sync_suite_products');
116 
117  $cron_job = new Cron_Job_Sync_Suite_Products();
118  $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
119  if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
120  trigger_error('Sync Squiz Suite Products Cron Job NOT CREATED', E_USER_ERROR);
121  }
122  pre_echo('Sync Squiz Suite Products Cron Job Id: '.$cron_job->id);
123 
124  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('cron_job_sync_suite_products', $cron_job->id);
125 
126  return $cron_job;
127 
128  }//end createCronJobSyncSuiteProducts()
129 
130 
131 }//end class
132 
133 ?>