summaryrefslogtreecommitdiffstats
path: root/apps/files/appinfo/update.php
blob: d8886328d8fe9f4f3ce3f3c41e7691f3226e1997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

// 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', '<')) {
	// SQL92 string concatenation is ||, some of the DBMS don't know that
	if (OC_Config::getValue('dbtype') === 'mysql') {
		$concat = "concat('{DAV:}', `propertyname`)";
	} else if (OC_Config::getValue('dbtype') === 'mssql') {
		$concat = "'{DAV:}' + `propertyname`";
	} else {
		$concat = "'{DAV:}' || `propertyname`";
	}
	$query = OC_DB::prepare( "UPDATE  `*PREFIX*properties`
								  SET `propertyname` = $concat
								WHERE `propertyname` LIKE '{%'" );
}

//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;
	}
	$success = OCP\Files::rmdirr($filepath);
	if($success === false) {
		//probably not sufficient privileges, give up and give a message.
		OCP\Util::writeLog('files', 'Could not clean /files/ directory.'
				.' Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR);
		break;
	}
}