Changeset 1355
- Timestamp:
- 09/21/08 15:17:18
(2 months ago)
- Author:
- scitech
- Message:
Cleaning update functions code
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1327 |
r1355 |
|
| 64 | 64 | )); |
|---|
| 65 | 65 | |
|---|
| 66 | | if(checkDatabaseUpdateExists()) { |
|---|
| | 66 | if(databaseUpdate::getInstance()->checkUpdateExists()) { |
|---|
| 67 | 67 | $tpl->assign(array( |
|---|
| 68 | 68 | 'UPDATE_MESSAGE' => '', |
|---|
| … | … | |
| 82 | 82 | // Execute all available db updates and redirect back to database_update.php |
|---|
| 83 | 83 | if($execute) { |
|---|
| 84 | | executeDatabaseUpdates(); |
|---|
| | 84 | databaseUpdate::getInstance()->executeUpdates(); |
|---|
| 85 | 85 | header('Location:' . $_SERVER['PHP_SELF']); |
|---|
| 86 | 86 | } |
|---|
| r1351 |
r1355 |
|
| 74 | 74 | $sql = Database::getInstance(); |
|---|
| 75 | 75 | |
|---|
| 76 | | if (checkNewCriticalRevisionExists()) { |
|---|
| 77 | | executeCriticalUpdates(); |
|---|
| | 76 | if (criticalUpdate::getInstance()->checkUpdateExists()) { |
|---|
| | 77 | criticalUpdate::getInstance()->executeUpdates(); |
|---|
| 78 | 78 | $tpl->assign(array('CRITICAL_MESSAGE' => 'Critical update has been performed')); |
|---|
| 79 | 79 | $tpl->parse('CRITICAL_UPDATE_MESSAGE', 'critical_update_message'); |
|---|
| … | … | |
| 81 | 81 | else { |
|---|
| 82 | 82 | $tpl->assign(array('CRITICAL_UPDATE_MESSAGE' => '')); |
|---|
| | 83 | } |
|---|
| | 84 | |
|---|
| | 85 | if(databaseUpdate::getInstance()->checkUpdateExists()) { |
|---|
| | 86 | $tpl->assign(array('DATABASE_UPDATE' => '<a href="database_update.php" class=\"link\">' . tr('A database update is available') . '</a>')); |
|---|
| | 87 | $tpl->parse('DATABASE_UPDATE_MESSAGE', 'database_update_message'); |
|---|
| | 88 | } else { |
|---|
| | 89 | $tpl->assign(array('DATABASE_UPDATE_MESSAGE' => '')); |
|---|
| 83 | 90 | } |
|---|
| 84 | 91 | |
|---|
| 85 | 92 | if (!Config::get('CHECK_FOR_UPDATES')) { |
|---|
| 86 | 93 | $tpl->assign(array('UPDATE' => tr('Update checking is disabled!'))); |
|---|
| 87 | | $tpl->assign(array('DATABASE_UPDATE_MESSAGE' => '')); |
|---|
| 88 | 94 | $tpl->parse('UPDATE_MESSAGE', 'update_message'); |
|---|
| 89 | 95 | return false; |
|---|
| 90 | 96 | } |
|---|
| 91 | 97 | |
|---|
| 92 | | $last_update = "http://www.isp-control.net/latest.txt"; |
|---|
| 93 | | // Fake the browser type |
|---|
| 94 | | ini_set('user_agent', 'Mozilla/5.0'); |
|---|
| 95 | | |
|---|
| 96 | | $timeout = 2; |
|---|
| 97 | | $old_timeout = ini_set('default_socket_timeout', $timeout); |
|---|
| 98 | | $dh2 = @fopen($last_update, 'r'); |
|---|
| 99 | | ini_set('default_socket_timeout', $old_timeout); |
|---|
| 100 | | |
|---|
| 101 | | if (!is_resource($dh2)) { |
|---|
| 102 | | $tpl->assign(array('UPDATE' => tr("Couldn't check for updates! Website not reachable."))); |
|---|
| 103 | | $tpl->assign(array('DATABASE_UPDATE_MESSAGE' => '')); |
|---|
| 104 | | $tpl->parse('UPDATE_MESSAGE', 'update_message'); |
|---|
| 105 | | return false; |
|---|
| 106 | | } |
|---|
| 107 | | |
|---|
| 108 | | $last_update_result = (int)fread($dh2, 8); |
|---|
| 109 | | fclose($dh2); |
|---|
| 110 | | |
|---|
| 111 | | $current_version = (int)Config::get('BuildDate'); |
|---|
| 112 | | if ($current_version < $last_update_result) { |
|---|
| | 98 | if (versionUpdate::getInstance()->checkUpdateExists()) { |
|---|
| 113 | 99 | $tpl->assign(array('UPDATE' => '<a href="ispcp_updates.php" class=\"link\">' . tr('New ispCP update is now available') . '</a>')); |
|---|
| 114 | 100 | $tpl->parse('UPDATE_MESSAGE', 'update_message'); |
|---|
| 115 | 101 | } else { |
|---|
| 116 | 102 | $tpl->assign(array('UPDATE_MESSAGE' => '')); |
|---|
| 117 | | } |
|---|
| 118 | | |
|---|
| 119 | | if(checkDatabaseUpdateExists()) { |
|---|
| 120 | | $tpl->assign(array('DATABASE_UPDATE' => '<a href="database_update.php" class=\"link\">' . tr('A database update is available') . '</a>')); |
|---|
| 121 | | $tpl->parse('DATABASE_UPDATE_MESSAGE', 'database_update_message'); |
|---|
| 122 | | } else { |
|---|
| 123 | | $tpl->assign(array('DATABASE_UPDATE_MESSAGE' => '')); |
|---|
| 124 | 103 | } |
|---|
| 125 | 104 | } |
|---|
| r1327 |
r1355 |
|
| 56 | 56 | } |
|---|
| 57 | 57 | |
|---|
| 58 | | |
|---|
| 59 | | $info_url = 'http://www.isp-control.net/download.html'; |
|---|
| 60 | | $last_update = 'http://www.isp-control.net/latest.txt'; |
|---|
| 61 | | // Fake the browser type |
|---|
| 62 | | ini_set('user_agent', 'Mozilla/5.0'); |
|---|
| 63 | | |
|---|
| 64 | | $timeout = 2; |
|---|
| 65 | | $old_timeout = ini_set('default_socket_timeout', $timeout); |
|---|
| 66 | | $dh2 = @fopen($last_update, 'r'); |
|---|
| 67 | | ini_set('default_socket_timeout', $old_timeout); |
|---|
| 68 | | |
|---|
| 69 | | if (!is_resource($dh2)) { |
|---|
| 70 | | $tpl->assign(array('UPDATE' => tr("Couldn't check for updates! Website not reachable."))); |
|---|
| 71 | | $tpl->parse('UPDATE_MESSAGE', 'update_message'); |
|---|
| 72 | | return false; |
|---|
| 73 | | } |
|---|
| 74 | | |
|---|
| 75 | | $last_update_result = (int)fread($dh2, 8); |
|---|
| 76 | | fclose($dh2); |
|---|
| 77 | | |
|---|
| 78 | | $current_version = (int)Config::get('BuildDate'); |
|---|
| 79 | | if ($current_version < $last_update_result) { |
|---|
| | 58 | if (versionUpdate::getInstance()->checkUpdateExists()) { |
|---|
| 80 | 59 | $tpl->assign( |
|---|
| 81 | 60 | array( |
|---|
| 82 | 61 | 'UPDATE_MESSAGE' => '', |
|---|
| 83 | 62 | 'UPDATE' => tr('New ispCP update is now available'), |
|---|
| 84 | | 'INFOS' => tr('Get it at') . " <a href=\"" . $info_url . "\" class=\"link\" target=\"ispcp\">" . $info_url . "</a>" |
|---|
| | 63 | 'INFOS' => tr('Get it at') . " <a href=\"http://www.isp-control.net/download.html\" class=\"link\" target=\"ispcp\">http://www.isp-control.net/download.html</a>" |
|---|
| 85 | 64 | ) |
|---|
| 86 | 65 | ); |
|---|
| r1349 |
r1355 |
|
| 170 | 170 | require_once(INCLUDEPATH . '/layout-functions.php'); |
|---|
| 171 | 171 | require_once(INCLUDEPATH . '/functions.ticket_system.php'); |
|---|
| 172 | | require_once(INCLUDEPATH . '/database-update-functions.php'); |
|---|
| 173 | | require_once(INCLUDEPATH . '/critical-update-functions.php'); |
|---|
| | 172 | require_once(INCLUDEPATH . '/class.ispcp-update.php'); |
|---|
| | 173 | require_once(INCLUDEPATH . '/class.database-update.php'); |
|---|
| | 174 | require_once(INCLUDEPATH . '/class.critical-update.php'); |
|---|
| 174 | 175 | require_once(INCLUDEPATH . '/htmlpurifier/HTMLPurifier.auto.php'); |
|---|
| 175 | 176 | //require_once(INCLUDEPATH . '/htmlpurifier/HTMLPurifier.func.php'); |
|---|
|
Download in other formats:
#########################################################################
# Site footer - Contents are automatically inserted after main Trac HTML
?>