17 require_once SQ_INCLUDE_PATH.
'/package_manager.inc';
40 $this->_full_path = SQ_CORE_PACKAGE_PATH;
79 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
80 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
83 if (!parent::updatePackageDetails($update_assets)) {
84 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
85 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
90 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
91 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
112 'system_management_folder',
114 'web_folder_designs',
121 'authentication_folder',
130 'password_change_design',
131 'cron_job_expired_workflow',
132 'cron_job_generate_log_reports',
133 'cron_job_escalate_safe_trash',
135 'cron_job_metadata_triggers',
136 'cron_job_expired_matrix_cache',
137 'cron_job_expired_matrix_locks',
151 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'root_folder');
155 if (!$root_folder->create($link)) {
156 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Root Folder');
159 pre_echo(
'Root Folder Asset Id : '.$root_folder->id);
160 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'root_folder', $root_folder->id);
175 $root_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_folder');
177 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'trash_folder');
179 'asset' => &$root_folder,
180 'link_type' => SQ_LINK_TYPE_1,
186 if (!$trash_folder->create($trash_link)) {
187 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Trash Folder');
189 pre_echo(
'Trash Asset Id : '.$trash_folder->id);
191 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'trash_folder', $trash_folder->id);
192 return $trash_folder;
205 $users_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'web_folder_users');
207 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'public_user');
209 $public_user_link = Array(
210 'asset' => &$users_folder,
211 'link_type' => SQ_LINK_TYPE_1,
214 if (!$public_user->create($public_user_link)) {
215 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Public Access User');
217 pre_echo(
'Public Access User Asset Id : '.$public_user->id);
219 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'public_user', $public_user->id);
234 $root_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_folder');
236 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'system_management_folder');
238 $system_management_folder_link = Array(
239 'asset' => &$root_folder,
240 'link_type' => SQ_LINK_TYPE_1,
245 if (!$system_management_folder->create($system_management_folder_link)) {
246 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'System Management Folder');
248 pre_echo(
'System Management Asset Id : '.$system_management_folder->id);
250 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'system_management_folder', $system_management_folder->id);
251 return $system_management_folder;
264 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
266 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'system_user_group');
268 $system_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
269 if (!$system_user_group->create($system_link)) {
270 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'System Admin Group');
272 pre_echo(
'System Administrators User Group Asset Id : '.$system_user_group->id);
274 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'system_user_group', $system_user_group->id);
275 return $system_user_group;
289 $current_run_level = $GLOBALS[
'SQ_SYSTEM']->getRunLevel();
290 $GLOBALS[
'SQ_SYSTEM']->setRunLevel($current_run_level - SQ_SECURITY_PASSWORD_VALIDATION);
292 $system_user_group = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_user_group');
294 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'root_user');
296 $user_link = Array(
'asset' => &$system_user_group,
'link_type' => SQ_LINK_TYPE_1);
298 $root_pass = isset($_SESSION[
'install_root_pass']) ? $_SESSION[
'install_root_pass'] :
'root';
300 $root_user->setAttrValue(
'password', $root_pass);
301 $root_user->setAttrValue(
'first_name',
'Root');
302 $root_user->setAttrValue(
'last_name',
'User');
303 $root_email = (SQ_CONF_DEFAULT_EMAIL) ? SQ_CONF_DEFAULT_EMAIL : (
'root@'.((SQ_PHP_CLI) ? php_uname(
'n') : $_SERVER[
'HTTP_HOST']));
304 $root_user->setAttrValue(
'email', $root_email);
306 if (!$root_user->create($user_link)) {
307 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Root User');
310 pre_echo(
'Root User Asset Id : '.$root_user->id);
312 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'root_user', $root_user->id);
313 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
327 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
329 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_manager');
331 $cron_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
332 if (!$cron_manager->create($cron_manager_link)) {
333 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Cron Manager');
335 pre_echo(
'Cron Manager Asset Id : '.$cron_manager->id);
337 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_manager', $cron_manager->id);
338 return $cron_manager;
351 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
353 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'trigger_manager');
355 $trigger_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
356 if (!$trigger_manager->create($trigger_manager_link)) {
357 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Trigger Manager');
359 pre_echo(
'Trigger Manager Asset Id : '.$trigger_manager->id);
361 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'trigger_manager', $trigger_manager->id);
362 return $trigger_manager;
375 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
377 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'log_manager');
379 $log_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
380 if (!$log_manager->create($log_manager_link)) {
381 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Trigger Manager');
383 pre_echo(
'Log Manager Asset Id : '.$log_manager->id);
385 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'log_manager', $log_manager->id);
399 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
401 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'layout_manager');
403 $layout_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
404 if (!$layout_manager->create($layout_manager_link)) {
405 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Layout Manager');
407 pre_echo(
'Layout Manager Asset Id : '.$layout_manager->id);
409 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'layout_manager', $layout_manager->id);
410 return $layout_manager;
423 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
425 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'remap_manager');
427 $remap_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
428 if (!$remap_manager->create($remap_manager_link)) {
429 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Remap Manager');
431 pre_echo(
'Remap Manager Asset Id : '.$remap_manager->id);
433 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'remap_manager',$remap_manager->id);
434 return $remap_manager;
447 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
449 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cache_manager');
451 $cache_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
452 if (!$cache_manager->create($cache_manager_link)) {
453 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Cache Manager');
455 pre_echo(
'Cache Manager Asset Id : '.$cache_manager->id);
457 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cache_manager', $cache_manager->id);
458 return $cache_manager;
471 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
473 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'designs_folder');
475 $designs_folder_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
476 if (!$designs_folder->create($designs_folder_link)) {
477 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Designs Folder');
479 pre_echo(
'Design Folder Asset Id : '.$designs_folder->id);
481 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'designs_folder', $designs_folder->id);
482 return $designs_folder;
495 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
497 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'authentication_folder');
499 $authentication_folder_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
500 if (!$authentication_folder->create($authentication_folder_link)) {
501 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Authentication Folder');
503 pre_echo(
'Authentication Folder Asset Id : '.$authentication_folder->id);
505 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'authentication_folder', $authentication_folder->id);
506 return $authentication_folder;
519 $designs_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'designs_folder');
521 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'login_design');
523 $login_design_link = Array(
'asset' => &$designs_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
524 $login_design->setAttrValue(
'id_name',
'login_design');
525 if (!$login_design->create($login_design_link)) {
526 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Login Design');
528 pre_echo(
'Login Design Asset Id : '.$login_design->id);
530 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'login_design', $login_design->id);
531 return $login_design;
544 $designs_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'designs_folder');
546 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'ees_login_design');
548 $login_design_link = Array(
'asset' => &$designs_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
549 $login_design->setAttrValue(
'id_name',
'ees_login_design');
550 if (!$login_design->create($login_design_link)) {
551 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'EES Login Design');
553 pre_echo(
'EES Login Design Asset Id : '.$login_design->id);
555 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'ees_login_design', $login_design->id);
556 return $login_design;
568 $designs_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'designs_folder');
570 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'password_change_design');
572 $password_change_design_link = Array(
'asset' => &$designs_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
573 $password_change_design->setAttrValue(
'id_name',
'password_change_design');
574 if (!$password_change_design->create($password_change_design_link)) {
575 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Password Change Design');
577 pre_echo(
'Password Change Design Asset Id : '.$password_change_design->id);
579 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'password_change_design', $password_change_design->id);
580 return $password_change_design;
593 $root_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_folder');
595 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'web_folder_designs');
596 $folder_link = Array(
597 'asset' => &$root_folder,
598 'link_type' => SQ_LINK_TYPE_1,
603 $designs_folder->setAttrValue(
'name',
'Designs Folder');
604 if (!$designs_folder->create($folder_link)) {
605 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Designs Folder');
607 pre_echo(
'Designs Folder Id : '.$designs_folder->id);
609 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'web_folder_designs', $designs_folder->id);
610 return $designs_folder;
623 $root_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_folder');
625 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'web_folder_media');
626 $folder_link = Array(
627 'asset' => &$root_folder,
628 'link_type' => SQ_LINK_TYPE_1,
633 $media_folder->setAttrValue(
'name',
'Media Folder');
634 if (!$media_folder->create($folder_link)) {
635 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Media Folder');
637 pre_echo(
'Media Folder Id : '.$media_folder->id);
639 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'web_folder_media', $media_folder->id);
640 return $media_folder;
653 $root_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_folder');
655 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'web_folder_users');
656 $folder_link = Array(
657 'asset' => &$root_folder,
658 'link_type' => SQ_LINK_TYPE_1,
663 $users_folder->setAttrValue(
'name',
'Users Folder');
664 if (!$users_folder->create($folder_link)) {
665 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Users Folder');
667 pre_echo(
'Users Folder Id : '.$users_folder->id);
669 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'web_folder_users', $users_folder->id);
670 return $users_folder;
683 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
684 if (is_null($cron_manager)) {
685 trigger_localised_error(
'CORE0022', E_USER_WARNING);
690 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_expired_workflow');
693 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
694 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
695 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Expired Workflow Cron Job');
697 pre_echo(
'Expired Workflow Cron Job Id: '.$cron_job->id);
699 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_expired_workflow', $cron_job->id);
714 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
715 if (is_null($cron_manager)) {
716 trigger_error(
'Couldn\'t get cron manager, couldn\'t create generate log reports cron job', E_USER_WARNING);
721 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_generate_log_reports');
724 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
725 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
726 trigger_error(
'Generate Log Reports Cron Job NOT CREATED', E_USER_ERROR);
728 pre_echo(
'Generate Log Reports Cron Job Id: '.$cron_job->id);
730 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_generate_log_reports', $cron_job->id);
745 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
746 if (is_null($cron_manager)) {
747 trigger_error(
'Couldn\'t get cron manager, couldn\'t create Escalate Safe Trash Cron Job', E_USER_WARNING);
752 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_generate_log_reports');
755 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
756 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
757 trigger_error(
'Escalate Safe Trash Cron Job NOT CREATED', E_USER_ERROR);
759 pre_echo(
'Escalate Safe Trash Cron Job Id: '.$cron_job->id);
761 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_escalate_safe_trash', $cron_job->id);
776 $system_management_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_management_folder');
778 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'tag_manager');
780 $tag_manager_link = Array(
'asset' => &$system_management_folder,
'link_type' => SQ_LINK_TYPE_1,
'is_exclusive' => 1);
781 if (!$tag_manager->create($tag_manager_link)) {
782 trigger_localised_error(
'CORE0001', E_USER_ERROR,
'Trigger Manager');
784 pre_echo(
'Tag Manager Asset Id : '.$tag_manager->id);
786 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'tag_manager', $tag_manager->id);
800 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
801 if (is_null($cron_manager)) {
802 trigger_error(
'Couldn\'t get cron manager, couldn\'t create Metadata Trigger cron job', E_USER_WARNING);
807 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_metadata_triggers');
810 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
811 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
812 trigger_error(
'Metadata Triggers Cron Job NOT CREATED', E_USER_ERROR);
814 pre_echo(
'Metadata Triggers Cron Job Id: '.$cron_job->id);
816 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_metadata_triggers', $cron_job->id);
831 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
832 if (is_null($cron_manager)) {
833 trigger_error(
'Couldn\'t get cron manager, couldn\'t create Expired Matrix Cache cron job', E_USER_WARNING);
838 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_expired_matrix_cache');
841 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
842 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
843 trigger_error(
'Expired Matrix Cache Cron Job NOT CREATED', E_USER_ERROR);
845 pre_echo(
'Expired Matrix Cache Cron Job Id: '.$cron_job->id);
847 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_expired_matrix_cache', $cron_job->id);
862 $cron_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
863 if (is_null($cron_manager)) {
864 trigger_error(
'Couldn\'t get cron manager, couldn\'t create Expired Matrix Locks cron job', E_USER_WARNING);
869 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_expired_matrix_locks');
872 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
873 if (!$cron_manager->addJob($cron_job, $root_user, SQ_LINK_TYPE_2)) {
874 trigger_error(
'Expired Matrix Locks Cron Job NOT CREATED', E_USER_ERROR);
876 pre_echo(
'Expired Matrix Locks Cron Job Id: '.$cron_job->id);
878 $GLOBALS[
'SQ_SYSTEM']->am->registerSystemAsset(
'cron_job_expired_matrix_locks', $cron_job->id);