2015-06-26 06:31:53 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
2015-03-27 02:00:01 +01:00
|
|
|
|
2015-06-26 06:31:53 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
2017-12-10 22:14:12 +01:00
|
|
|
function updateBludit() {
|
2018-07-17 19:13:01 +02:00
|
|
|
global $site;
|
2018-11-02 00:24:27 +01:00
|
|
|
global $syslog;
|
|
|
|
|
2018-10-07 15:54:28 +02:00
|
|
|
// New installation
|
|
|
|
if ($site->currentBuild()==0) {
|
|
|
|
$site->set(array('currentBuild'=>BLUDIT_BUILD));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if Bludit need to be update
|
|
|
|
if ( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) {
|
2017-12-10 22:14:12 +01:00
|
|
|
Log::set('UPDATE SYSTEM - Starting.');
|
2017-05-16 00:46:20 +02:00
|
|
|
|
2018-09-16 19:26:23 +02:00
|
|
|
// Updates only for version less than Bludit v3.0 rc-3
|
2018-10-06 19:59:12 +02:00
|
|
|
if ($site->currentBuild()<='20180910') {
|
2018-09-16 19:26:23 +02:00
|
|
|
@mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true);
|
|
|
|
$plugins = array('simple-stats', 'pluginRSS', 'pluginSitemap', 'pluginTimeMachineX', 'pluginBackup');
|
|
|
|
foreach ($plugins as $plugin) {
|
|
|
|
if (pluginActivated($plugin)) {
|
|
|
|
Log::set('UPDATE SYSTEM - Re-enable plugin: '.$plugin);
|
|
|
|
deactivatePlugin($plugin);
|
|
|
|
activatePlugin($plugin);
|
|
|
|
}
|
2018-09-10 20:23:37 +02:00
|
|
|
}
|
2017-12-10 22:14:12 +01:00
|
|
|
}
|
2017-05-16 00:46:20 +02:00
|
|
|
|
2018-10-06 19:39:34 +02:00
|
|
|
// Updates only for version less than Bludit v3.1
|
2018-10-06 19:59:12 +02:00
|
|
|
if ($site->currentBuild()<='20180921') {
|
2018-10-06 19:39:34 +02:00
|
|
|
@mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true);
|
|
|
|
$site->set(array('imageRelativeToAbsolute'=>true, 'imageRestrict'=>false));
|
|
|
|
}
|
|
|
|
|
2017-12-10 22:14:12 +01:00
|
|
|
// Set the current build number
|
2018-07-17 19:13:01 +02:00
|
|
|
$site->set(array('currentBuild'=>BLUDIT_BUILD));
|
2017-12-10 22:14:12 +01:00
|
|
|
Log::set('UPDATE SYSTEM - Finished.');
|
2018-11-02 00:24:27 +01:00
|
|
|
|
|
|
|
// Add to syslog
|
|
|
|
$syslog->add(array(
|
|
|
|
'dictionaryKey'=>'system-updated',
|
|
|
|
'notes'=>'Bludit v'.BLUDIT_VERSION
|
|
|
|
));
|
2017-12-10 22:14:12 +01:00
|
|
|
}
|
|
|
|
}
|
2015-03-27 02:00:01 +01:00
|
|
|
|
2015-08-03 02:49:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-06-26 06:31:53 +02:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
2015-08-03 02:49:12 +02:00
|
|
|
// Main after POST
|
2015-06-26 06:31:53 +02:00
|
|
|
// ============================================================================
|
|
|
|
|
2015-11-20 04:21:39 +01:00
|
|
|
// Try update Bludit
|
2017-12-10 22:14:12 +01:00
|
|
|
updateBludit();
|
2015-07-27 02:29:47 +02:00
|
|
|
|
2017-09-09 00:33:14 +02:00
|
|
|
// Title of the page
|
2018-08-05 17:54:20 +02:00
|
|
|
$layout['title'] .= ' - '.$L->g('Dashboard');
|