diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/db.php | 8 | ||||
-rw-r--r-- | lib/files/cache/legacy.php | 2 | ||||
-rw-r--r-- | lib/files/cache/scanner.php | 66 | ||||
-rw-r--r-- | lib/files/view.php | 6 | ||||
-rw-r--r-- | lib/installer.php | 6 | ||||
-rw-r--r-- | lib/l10n/fi.php | 3 | ||||
-rw-r--r-- | lib/l10n/id.php | 2 | ||||
-rw-r--r-- | lib/l10n/sl.php | 10 | ||||
-rw-r--r-- | lib/l10n/sq.php | 39 | ||||
-rw-r--r-- | lib/setup.php | 6 | ||||
-rw-r--r-- | lib/templatelayout.php | 2 | ||||
-rw-r--r-- | lib/user.php | 2 | ||||
-rwxr-xr-x | lib/util.php | 29 |
13 files changed, 124 insertions, 57 deletions
diff --git a/lib/db.php b/lib/db.php index 5a91421f7ab..f28ed24df41 100644 --- a/lib/db.php +++ b/lib/db.php @@ -367,7 +367,9 @@ class OC_DB { // Optimize the query $query = self::processQuery( $query ); - + if(OC_Config::getValue( "log_query", false)) { + OC_Log::write('core', 'DB prepare : '.$query, OC_Log::DEBUG); + } self::connect(); // return the result if(self::$backend==self::BACKEND_MDB2) { @@ -952,6 +954,10 @@ class PDOStatementWrapper{ * make execute return the result instead of a bool */ public function execute($input=array()) { + if(OC_Config::getValue( "log_query", false)) { + $params_str = str_replace("\n"," ",var_export($input,true)); + OC_Log::write('core', 'DB execute with arguments : '.$params_str, OC_Log::DEBUG); + } $this->lastArguments = $input; if (count($input) > 0) { diff --git a/lib/files/cache/legacy.php b/lib/files/cache/legacy.php index f114cf0c837..9556a2639a3 100644 --- a/lib/files/cache/legacy.php +++ b/lib/files/cache/legacy.php @@ -97,7 +97,7 @@ class Legacy { $relativePath = ''; } if(is_null($query)){ - $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND propertypath = ? AND propertyname = "{DAV:}getetag"'); + $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = \'{DAV:}getetag\''); } $result = $query->execute(array($user, '/' . $relativePath)); if ($row = $result->fetchRow()) { diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 661ece5b120..f019d4fc608 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -62,32 +62,35 @@ class Scanner { * @return array with metadata of the scanned file */ public function scanFile($file, $checkExisting = false) { - \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); - $data = $this->getData($file); - if ($data) { - if ($file) { - $parent = dirname($file); - if ($parent === '.') { - $parent = ''; - } - if (!$this->cache->inCache($parent)) { - $this->scanFile($parent); + if (!self::isIgnoredFile($file)) { + \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); + $data = $this->getData($file); + if ($data) { + if ($file) { + $parent = dirname($file); + if ($parent === '.') { + $parent = ''; + } + if (!$this->cache->inCache($parent)) { + $this->scanFile($parent); + } } - } - if($cacheData = $this->cache->get($file)) { - if ($data['mtime'] === $cacheData['mtime'] && - $data['size'] === $cacheData['size']) { - $data['etag'] = $cacheData['etag']; + if($cacheData = $this->cache->get($file)) { + if ($data['mtime'] === $cacheData['mtime'] && + $data['size'] === $cacheData['size']) { + $data['etag'] = $cacheData['etag']; + } } - } - if ($checkExisting and $cacheData) { - if ($data['size'] === -1) { - $data['size'] = $cacheData['size']; + if ($checkExisting and $cacheData) { + if ($data['size'] === -1) { + $data['size'] = $cacheData['size']; + } } + $this->cache->put($file, $data); } - $this->cache->put($file, $data); + return $data; } - return $data; + return null; } /** @@ -109,8 +112,8 @@ class Scanner { if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) { \OC_DB::beginTransaction(); while ($file = readdir($dh)) { - if (!$this->isIgnoredFile($file)) { - $child = ($path) ? $path . '/' . $file : $file; + $child = ($path) ? $path . '/' . $file : $file; + if (!$this->isIgnoredDir($file)) { $data = $this->scanFile($child, $recursive === self::SCAN_SHALLOW); if ($data) { if ($data['size'] === -1) { @@ -145,15 +148,26 @@ class Scanner { } /** + * @brief check if the directory should be ignored when scanning + * NOTE: the special directories . and .. would cause never ending recursion + * @param String $dir + * @return boolean + */ + private function isIgnoredDir($dir) { + if ($dir === '.' || $dir === '..') { + return true; + } + return false; + } + /** * @brief check if the file should be ignored when scanning * NOTE: files with a '.part' extension are ignored as well! * prevents unfinished put requests to be scanned * @param String $file * @return boolean */ - private function isIgnoredFile($file) { - if ($file === '.' || $file === '..' - || pathinfo($file, PATHINFO_EXTENSION) === 'part' + public static function isIgnoredFile($file) { + if (pathinfo($file, PATHINFO_EXTENSION) === 'part' || \OC\Files\Filesystem::isFileBlacklisted($file) ) { return true; diff --git a/lib/files/view.php b/lib/files/view.php index 19f33ad64a2..e811fb093cc 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -267,7 +267,7 @@ class View { $path = $this->getRelativePath($absolutePath); $exists = $this->file_exists($path); $run = true; - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -295,7 +295,7 @@ class View { list ($count, $result) = \OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -627,7 +627,7 @@ class View { private function runHooks($hooks, $path, $post = false) { $prefix = ($post) ? 'post_' : ''; $run = true; - if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot()) { + if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { foreach ($hooks as $hook) { if ($hook != 'read') { \OC_Hook::emit( diff --git a/lib/installer.php b/lib/installer.php index 251d115b76c..49ba4492632 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -134,8 +134,10 @@ class OC_Installer{ } // check if the app is compatible with this version of ownCloud - $version=OC_Util::getVersion(); - if(!isset($info['require']) or ($version[0]>$info['require'])) { + if( + !isset($info['require']) + or !OC_App::isAppVersionCompatible(OC_Util::getVersion(), $info['require']) + ) { OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR); diff --git a/lib/l10n/fi.php b/lib/l10n/fi.php new file mode 100644 index 00000000000..daaddb25e48 --- /dev/null +++ b/lib/l10n/fi.php @@ -0,0 +1,3 @@ +<?php $TRANSLATIONS = array( +"Settings" => "asetukset" +); diff --git a/lib/l10n/id.php b/lib/l10n/id.php index 8f0e38123b6..32ab5a63dd3 100644 --- a/lib/l10n/id.php +++ b/lib/l10n/id.php @@ -15,6 +15,8 @@ "Files" => "Berkas", "Text" => "teks", "Images" => "Gambar", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web server anda belum terkonfigurasi untuk mengijinkan sinkronisasi berkas karena sepertinya antarmuka WebDAV rusak.", +"Please double check the <a href='%s'>installation guides</a>." => "Silakan periksa ulang <a href='%s'>panduan instalasi</a>.", "seconds ago" => "beberapa detik yang lalu", "1 minute ago" => "1 menit lalu", "%d minutes ago" => "%d menit lalu", diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php index c0363031979..a2e1719de87 100644 --- a/lib/l10n/sl.php +++ b/lib/l10n/sl.php @@ -21,12 +21,12 @@ "Specify a data folder." => "Določi podatkovno mapo.", "%s enter the database username." => "%s - vnos uporabniškega imena podatkovne zbirke.", "%s enter the database name." => "%s - vnos imena podatkovne zbirke.", -"%s you may not use dots in the database name" => "%s - v imenu podatkovne zbirke ni dovoljeno vpisati pik.", +"%s you may not use dots in the database name" => "%s - v imenu podatkovne zbirke ni dovoljeno uporabljati pik.", "%s set the database host." => "%s - vnos gostitelja podatkovne zbirke.", -"PostgreSQL username and/or password not valid" => "Uporabniško ime ali geslo PostgreSQL ni pravilno", +"PostgreSQL username and/or password not valid" => "Uporabniško ime ali geslo PostgreSQL ni veljavno", "You need to enter either an existing account or the administrator." => "Prijaviti se je treba v obstoječi ali pa skrbniški račun.", -"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni pravilno", -"MySQL username and/or password not valid" => "Uporabniško ime ali geslo MySQL ni pravilno", +"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni veljavno", +"MySQL username and/or password not valid" => "Uporabniško ime ali geslo MySQL ni veljavno", "DB Error: \"%s\"" => "Napaka podatkovne zbirke: \"%s\"", "Offending command was: \"%s\"" => "Napačni ukaz je: \"%s\"", "MySQL user '%s'@'localhost' exists already." => "Uporabnik MySQL '%s'@'localhost' že obstaja.", @@ -34,7 +34,7 @@ "MySQL user '%s'@'%%' already exists" => "Uporabnik MySQL '%s'@'%%' že obstaja.", "Drop this user from MySQL." => "Odstrani uporabnika s podatkovne zbirke MySQL", "Offending command was: \"%s\", name: %s, password: %s" => "Napačni ukaz je: \"%s\", ime: %s, geslo: %s", -"MS SQL username and/or password not valid: %s" => "Uporabniško ime ali geslo MS SQL ni pravilno: %s", +"MS SQL username and/or password not valid: %s" => "Uporabniško ime ali geslo MS SQL ni veljavno: %s", "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Spletni stražnik še ni ustrezno nastavljen in ne omogoča usklajevanja, saj je nastavitev WebDAV okvarjena.", "Please double check the <a href='%s'>installation guides</a>." => "Preverite <a href='%s'>navodila namestitve</a>.", "seconds ago" => "pred nekaj sekundami", diff --git a/lib/l10n/sq.php b/lib/l10n/sq.php new file mode 100644 index 00000000000..78c9977c3c6 --- /dev/null +++ b/lib/l10n/sq.php @@ -0,0 +1,39 @@ +<?php $TRANSLATIONS = array( +"Help" => "Ndihmë", +"Personal" => "Personale", +"Settings" => "Parametrat", +"Users" => "Përdoruesit", +"Apps" => "App", +"Admin" => "Admin", +"ZIP download is turned off." => "Shkarimi i skedarëve ZIP është i çaktivizuar.", +"Files need to be downloaded one by one." => "Skedarët duhet të shkarkohen një nga një.", +"Back to Files" => "Kthehu tek skedarët", +"Selected files too large to generate zip file." => "Skedarët e selektuar janë shumë të mëdhenj për të krijuar një skedar ZIP.", +"couldn't be determined" => "nuk u vendos dot", +"Application is not enabled" => "Programi nuk është i aktivizuar.", +"Authentication error" => "Gabim gjatë vërtetimit të identitetit", +"Token expired. Please reload page." => "Përmbajtja ka skaduar. Ju lutemi ringarkoni faqen.", +"Files" => "Skedarët", +"Text" => "Tekst", +"Images" => "Foto", +"Set an admin username." => "Cakto emrin e administratorit.", +"Set an admin password." => "Cakto kodin e administratorit.", +"Specify a data folder." => "Specifiko dosjen e të dhënave.", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serveri web i juaji nuk është konfiguruar akoma për të lejuar sinkronizimin e skedarëve sepse ndërfaqja WebDAV mund të jetë e dëmtuar.", +"Please double check the <a href='%s'>installation guides</a>." => "Ju lutemi kontrolloni mirë <a href='%s'>shoqëruesin e instalimit</a>.", +"seconds ago" => "sekonda më parë", +"1 minute ago" => "1 minutë më parë", +"1 hour ago" => "1 orë më parë", +"%d hours ago" => "%d orë më parë", +"today" => "sot", +"yesterday" => "dje", +"%d days ago" => "%d ditë më parë", +"last month" => "muajin e shkuar", +"%d months ago" => "%d muaj më parë", +"last year" => "vitin e shkuar", +"years ago" => "vite më parë", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s është i disponueshëm. <a href=\"%s\">Informohuni këtu</a>", +"up to date" => "i azhornuar", +"updates check is disabled" => "kontrollimi i azhurnimeve është i çaktivizuar", +"Could not find category \"%s\"" => "Kategoria \"%s\" nuk u gjet" +); diff --git a/lib/setup.php b/lib/setup.php index b4b07bd70e4..7082f0b2afd 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -243,7 +243,7 @@ class OC_Setup { $dbusername=substr('oc_'.$username, 0, 16); if($dbusername!=$oldUser) { //hash the password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$dbpass); + $dbpassword=OC_Util::generate_random_bytes(30); self::createDBUser($dbusername, $dbpassword, $connection); @@ -333,7 +333,7 @@ class OC_Setup { //add prefix to the postgresql user name to prevent collisions $dbusername='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $dbpassword=md5(time()); + $dbpassword=OC_Util::generate_random_bytes(30); self::pg_createDBUser($dbusername, $dbpassword, $connection); @@ -476,7 +476,7 @@ class OC_Setup { //add prefix to the oracle user name to prevent collisions $dbusername='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$dbpass); + $dbpassword=OC_Util::generate_random_bytes(30); //oracle passwords are treated as identifiers: // must start with aphanumeric char diff --git a/lib/templatelayout.php b/lib/templatelayout.php index 225830704a9..73094232230 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -37,7 +37,7 @@ class OC_TemplateLayout extends OC_Template { } else { parent::__construct('core', 'layout.base'); } - $versionParameter = '?' . md5(implode(OC_Util::getVersion())); + $versionParameter = '?v=' . md5(implode(OC_Util::getVersion())); // Add the js files $jsfiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); diff --git a/lib/user.php b/lib/user.php index 6144f0f6bf9..33e25268175 100644 --- a/lib/user.php +++ b/lib/user.php @@ -386,7 +386,7 @@ class OC_User { * generates a password */ public static function generatePassword() { - return uniqId(); + return OC_Util::generate_random_bytes(30); } /** diff --git a/lib/util.php b/lib/util.php index 7e8fc9b6bb7..6630c6a9e1a 100755 --- a/lib/util.php +++ b/lib/util.php @@ -411,18 +411,19 @@ class OC_Util { exit(); } - /** - * get an id unqiue for this instance - * @return string - */ - public static function getInstanceId() { - $id=OC_Config::getValue('instanceid', null); - if(is_null($id)) { - $id=uniqid(); - OC_Config::setValue('instanceid', $id); - } - return $id; - } + /** + * get an id unique for this instance + * @return string + */ + public static function getInstanceId() { + $id = OC_Config::getValue('instanceid', null); + if(is_null($id)) { + // We need to guarantee at least one letter in instanceid so it can be used as the session_name + $id = 'oc' . OC_Util::generate_random_bytes(10); + OC_Config::setValue('instanceid', $id); + } + return $id; + } /** * @brief Static lifespan (in seconds) when a request token expires. @@ -617,8 +618,8 @@ class OC_Util { $result = setlocale(LC_ALL, 'en_US.UTF-8', 'en_US.UTF8'); if($result == false) { return false; - } - return true; + } + return true; } /** |