2012-05-16 17:59:36 +04:00
|
|
|
<?php
|
|
|
|
|
2012-10-02 16:10:44 +04:00
|
|
|
// fix webdav properties,add namespace in front of the property, update for OC4.5
|
|
|
|
$installedVersion=OCP\Config::getAppValue('files', 'installed_version');
|
|
|
|
if (version_compare($installedVersion, '1.1.6', '<')) {
|
2013-11-01 18:45:33 +04:00
|
|
|
$concat = OC_DB::getConnection()->getDatabasePlatform()->
|
|
|
|
getConcatExpression( '\'{DAV:}\'', '`propertyname`' );
|
|
|
|
$query = OC_DB::prepare('
|
|
|
|
UPDATE `*PREFIX*properties`
|
|
|
|
SET `propertyname` = ' . $concat . '
|
|
|
|
WHERE `propertyname` NOT LIKE \'{%\'
|
|
|
|
');
|
|
|
|
$query->execute();
|
2012-07-19 16:35:28 +04:00
|
|
|
}
|
|
|
|
|
2012-05-16 17:59:36 +04:00
|
|
|
//update from OC 3
|
|
|
|
|
|
|
|
//try to remove remaining files.
|
|
|
|
//Give a warning if not possible
|
|
|
|
|
|
|
|
$filesToRemove = array(
|
|
|
|
'ajax',
|
|
|
|
'appinfo',
|
|
|
|
'css',
|
|
|
|
'js',
|
|
|
|
'l10n',
|
|
|
|
'templates',
|
|
|
|
'admin.php',
|
|
|
|
'download.php',
|
|
|
|
'index.php',
|
|
|
|
'settings.php'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach($filesToRemove as $file) {
|
|
|
|
$filepath = OC::$SERVERROOT . '/files/' . $file;
|
|
|
|
if(!file_exists($filepath)) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-11-29 21:30:02 +04:00
|
|
|
$success = OCP\Files::rmdirr($filepath);
|
|
|
|
if($success === false) {
|
2012-05-16 17:59:36 +04:00
|
|
|
//probably not sufficient privileges, give up and give a message.
|
2012-11-29 21:30:02 +04:00
|
|
|
OCP\Util::writeLog('files', 'Could not clean /files/ directory.'
|
|
|
|
.' Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR);
|
2012-05-16 17:59:36 +04:00
|
|
|
break;
|
2012-11-29 21:30:02 +04:00
|
|
|
}
|
2012-05-16 17:59:36 +04:00
|
|
|
}
|