18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
43 Asset_Management::__construct($pm);
47 'default' =>
'EES Login Design',
64 if (!parent::_upgrade($current_version))
return FALSE;
65 if (version_compare($current_version,
'0.2',
'<')) {
69 pre_echo(
'STARTING EES LOGIN DESIGN UPGRADE - FROM VERSION 0.1');
71 $new_parse_file = SQ_SYSTEM_ROOT.
'/core/assets/system/ees_login_design/design_files/index.html';
74 $source_parse_file_md5 = Array();
75 $source_parse_file_md5[] =
'a0596932a27bffbd9347d3944e9711de';
76 $source_parse_file_md5[] =
'5ad7fd75432a2df88880779a4b2804bd';
77 $source_parse_file_md5[] =
'ffdfb655681c6c05abff6163240a46af';
78 $source_parse_file_md5[] =
'46c990414c686b66bc8f949d124010bf';
79 $source_parse_file_md5[] =
'c00cf668108207f1a41a50ab767cb42d';
80 $source_parse_file_md5[] =
'c9f3ec8e7860951262e40de8e034c57c';
82 $new_file = file_get_contents($new_parse_file);
83 $design = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'ees_login_design');
84 $design_edit_fns = $design->getEditFns();
88 $parse_file = $design->data_path.
'/parse.txt';
89 $ext_file = file_get_contents($parse_file);
90 $parse_file_md5 = md5(file_get_contents($parse_file));
93 foreach ($source_parse_file_md5 as $md5key) {
94 if ($parse_file_md5 == $md5key) {
99 echo
'Parse file of EES login design has been modified. Skipping.'.
"\n";
100 pre_echo(
'EES LOGIN DESIGN UPGRADE COMPLETE - FROM VERSION 0.1');
103 if (!is_file($parse_file) || !is_file($new_parse_file)) {
104 trigger_error (
'parse file is not available');
110 if(!$this->
_updateFile($new_parse_file,
'parse.txt', $design->data_path, $design->data_path_suffix)) {
111 trigger_error(
'failed to update parse file '.$new_parse_file);
115 $design_edit_fns->parseAndProcessFile($design);
116 $design->generateDesignFile();
118 echo
'Parse file of EES login design is successfully updated...'.
"\n";
122 pre_echo(
'EES LOGIN DESIGN UPGRADE COMPLETE - FROM VERSION 0.1');
137 function _updateFile ($new_file, $file_name, $data_path, $data_path_suffix) {
138 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
139 $fv = $GLOBALS[
'SQ_SYSTEM']->getFileVersioning();
141 $file_path = $data_path.
'/'.$file_name;
143 if (!unlink($file_path)) {
144 trigger_error(
'failed to remove old file '.$file_name);
148 if (string_to_file(file_get_contents($new_file), $file_path)) {
150 $file_status = $fv->upToDate($file_path);
151 if (FUDGE_FV_MODIFIED & $file_status) {
152 if (!$fv->commit($file_path,
'')) {
153 trigger_localised_error(
'CORE0160', E_USER_WARNING);
157 trigger_error(
'Can not overwrite old file '.$file_name);
161 if (!$fv->checkOut($data_path_suffix.
'/'.$file_name, $data_path)) {
162 trigger_localised_error(
'CORE0032', E_USER_WARNING);