Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
package_manager_web_services.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/package_manager.inc';
18 
34 {
35 
36 
42  {
43  $this->_full_path = SQ_PACKAGES_PATH.'/web_services';
44  $this->Package_Manager();
45 
46  }//end constructor
47 
48 
49  //-- FUNCTIONS TO CREATE SYSTEM ASSETS --//
50 
51 
61  {
62  return Array(
63  'web_folder_web_services',
64  'rest_manager',
65  'cron_job_remove_soap_response_files',
66  );
67 
68  }//end getSystemAssetTypes()
69 
70 
78  {
79  $root_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_folder');
80 
81  $GLOBALS['SQ_SYSTEM']->am->includeAsset('web_folder_web_services');
82  $folder_link = Array(
83  'asset' => &$root_folder,
84  'link_type' => SQ_LINK_TYPE_1,
85  'is_exclusive' => 1,
86  'is_locked' => 1,
87  );
88  $web_services_folder = new Web_Folder_Web_Services();
89  $web_services_folder->setAttrValue('name', 'Web Services Folder');
90  if (!$web_services_folder->create($folder_link)) {
91  trigger_localised_error('CORE0001', E_USER_ERROR, 'Web Services Folder');
92  }
93  pre_echo('Web Services Folder Id : '.$web_services_folder->id);
94 
95  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('web_folder_web_services', $web_services_folder->id);
96 
97  $design_parse_file = $web_services_folder->getDesignParseFile();
98  $design_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('web_folder_designs');
99  $GLOBALS['SQ_SYSTEM']->am->includeAsset('design');
100 
101  $link_array = Array (
102  'asset' => $design_folder,
103  'value' => '',
104  'link_type' => SQ_LINK_TYPE_1,
105  'sort_order' => '',
106  'is_dependant' => 0,
107  'is_exclusive' => 0,
108  'is_locked' => 1,
109  );
110  $design = new Design();
111  $design->setAttrValue('id_name', 'Soap Server Design');
112  $design->create($link_array);
113 
114  require_once SQ_FUDGE_PATH.'/general/file_system.inc';
115 
116  create_directory($design->data_path);
117  string_to_file($design_parse_file, $design->data_path.'/parse.txt');
118 
119  $design_edit_fns = $design->getEditFns();
120  if (!$design_edit_fns->parseAndProcessFile($design)) {
121  trigger_error('Failed parsing updated parse file');
122  }//end if
123  $design->generateDesignFile();
124 
125  $GLOBALS['SQ_SYSTEM']->am->createAssetLink($web_services_folder, $design, SQ_LINK_NOTICE, 'design::system::frontend');
126  $web_services_folder->updateLookups();
127 
128  return $web_services_folder;
129 
130  }//end createWebFolderWebServices()
131 
132 
139  function &createRestManager()
140  {
141  $system_management_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('system_management_folder');
142 
143  $GLOBALS['SQ_SYSTEM']->am->includeAsset('rest_manager');
144  $rest_manager = new Rest_Manager();
145  $rest_manager_link = Array('asset' => &$system_management_folder, 'link_type' => SQ_LINK_TYPE_1, 'is_exclusive' => 1);
146  if (!$rest_manager->create($rest_manager_link)) {
147  trigger_localised_error('CORE0001', E_USER_ERROR, 'REST Manager');
148  }
149  pre_echo('REST Manager Asset Id : '.$rest_manager->id);
150 
151  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('rest_manager', $rest_manager->id);
152  return $rest_manager;
153 
154  }//end createRestManager()
155 
156 
164  {
165  $cron_manager = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('cron_manager');
166  if (is_null($cron_manager)) {
167  trigger_error('Couldn\'t get cron manager, couldn\'t create Remove SOAP Response Files cron job', E_USER_WARNING);
168  $null = NULL;
169  return $null;
170  }
171 
172  $GLOBALS['SQ_SYSTEM']->am->includeAsset('cron_job_remove_soap_response_files');
173 
174  $cron_job = new Cron_Job_Remove_SOAP_Response_Files();
175  $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
176  if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
177  trigger_error('Remove SOAP Response Files Cron Job NOT CREATED', E_USER_ERROR);
178  }
179  pre_echo('Remove SOAP Response Files Cron Job Id: '.$cron_job->id);
180 
181  $GLOBALS['SQ_SYSTEM']->am->registerSystemAsset('cron_job_remove_soap_response_files', $cron_job->id);
182 
183  return $cron_job;
184 
185  }//end createCronJobFunnelbackLogRotation()
186 
187 
188 }//end class
189 
190 ?>