diff options
author | Björn Schießle <schiessle@owncloud.com> | 2012-09-19 12:03:58 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2012-09-19 12:03:58 +0200 |
commit | c199c4ad67737754c2274a97e3137cee33b7e2d9 (patch) | |
tree | 01fb451f21a6fb4cc51259885f3aa2c95610039f /lib | |
parent | 6596094a284f8e800a2b50f9cf82973ce7daea2f (diff) | |
parent | 518ca0ac58c7cf762d0fc51f75cc886cedd495b0 (diff) | |
download | nextcloud-server-c199c4ad67737754c2274a97e3137cee33b7e2d9.tar.gz nextcloud-server-c199c4ad67737754c2274a97e3137cee33b7e2d9.zip |
Merge branch 'master' of github.com:owncloud/core
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/app.php | 17 | ||||
-rw-r--r-- | lib/connector/sabre/directory.php | 3 | ||||
-rw-r--r-- | lib/filechunking.php | 58 | ||||
-rw-r--r-- | lib/l10n/gl.php | 28 | ||||
-rw-r--r-- | lib/l10n/ro.php | 28 | ||||
-rw-r--r-- | lib/migrate.php | 14 | ||||
-rw-r--r-- | lib/migration/content.php | 19 | ||||
-rw-r--r-- | lib/ocsclient.php | 2 |
8 files changed, 144 insertions, 25 deletions
diff --git a/lib/app.php b/lib/app.php index 328095a90d2..38ba4bcdc88 100755 --- a/lib/app.php +++ b/lib/app.php @@ -563,7 +563,12 @@ class OC_App{ if ( is_array( $catagoryNames ) ) { - $categories = array_keys( $catagoryNames ); + // Check that categories of apps were retrieved correctly + if ( ! $categories = array_keys( $catagoryNames ) ) { + + return false; + + } $page = 0; @@ -589,7 +594,15 @@ class OC_App{ } - return $app1; + if ( empty( $app1 ) ) { + + return false; + + } else { + + return $app1; + + } } /** diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index b5049d800c4..bbc615c0b16 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -57,8 +57,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $chunk_handler->store($info['index'], $data); if ($chunk_handler->isComplete()) { $newPath = $this->path . '/' . $info['name']; - $f = OC_Filesystem::fopen($newPath, 'w'); - $chunk_handler->assemble($f); + $chunk_handler->file_assemble($newPath); return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); } } else { diff --git a/lib/filechunking.php b/lib/filechunking.php index d03af226d8b..5ab33c77ad7 100644 --- a/lib/filechunking.php +++ b/lib/filechunking.php @@ -55,12 +55,13 @@ class OC_FileChunking { public function assemble($f) { $cache = $this->getCache(); $prefix = $this->getPrefix(); + $count = 0; for($i=0; $i < $this->info['chunkcount']; $i++) { $chunk = $cache->get($prefix.$i); $cache->remove($prefix.$i); - fwrite($f,$chunk); + $count += fwrite($f,$chunk); } - fclose($f); + return $count; } public function signature_split($orgfile, $input) { @@ -91,4 +92,57 @@ class OC_FileChunking { 'count' => $count, ); } + + public function file_assemble($path) { + $absolutePath = OC_Filesystem::normalizePath(OC_Filesystem::getView()->getAbsolutePath($path)); + $data = ''; + // use file_put_contents as method because that best matches what this function does + if (OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data) && OC_Filesystem::isValidPath($path)) { + $path = OC_Filesystem::getView()->getRelativePath($absolutePath); + $exists = OC_Filesystem::file_exists($path); + $run = true; + if(!$exists) { + OC_Hook::emit( + OC_Filesystem::CLASSNAME, + OC_Filesystem::signal_create, + array( + OC_Filesystem::signal_param_path => $path, + OC_Filesystem::signal_param_run => &$run + ) + ); + } + OC_Hook::emit( + OC_Filesystem::CLASSNAME, + OC_Filesystem::signal_write, + array( + OC_Filesystem::signal_param_path => $path, + OC_Filesystem::signal_param_run => &$run + ) + ); + if(!$run) { + return false; + } + $target = OC_Filesystem::fopen($path, 'w'); + if($target) { + $count = $this->assemble($target); + fclose($target); + if(!$exists) { + OC_Hook::emit( + OC_Filesystem::CLASSNAME, + OC_Filesystem::signal_post_create, + array( OC_Filesystem::signal_param_path => $path) + ); + } + OC_Hook::emit( + OC_Filesystem::CLASSNAME, + OC_Filesystem::signal_post_write, + array( OC_Filesystem::signal_param_path => $path) + ); + OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count); + return $count > 0; + }else{ + return false; + } + } + } } diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php new file mode 100644 index 00000000000..7a9de627c2d --- /dev/null +++ b/lib/l10n/gl.php @@ -0,0 +1,28 @@ +<?php $TRANSLATIONS = array( +"Help" => "Axuda", +"Personal" => "Personal", +"Settings" => "Preferencias", +"Users" => "Usuarios", +"Apps" => "Apps", +"Admin" => "Administración", +"ZIP download is turned off." => "Descargas ZIP está deshabilitadas", +"Files need to be downloaded one by one." => "Os ficheiros necesitan ser descargados de un en un", +"Back to Files" => "Voltar a ficheiros", +"Selected files too large to generate zip file." => "Os ficheiros seleccionados son demasiado grandes para xerar un ficheiro ZIP", +"Application is not enabled" => "O aplicativo non está habilitado", +"Authentication error" => "Erro na autenticación", +"Token expired. Please reload page." => "Testemuño caducado. Por favor recargue a páxina.", +"seconds ago" => "hai segundos", +"1 minute ago" => "hai 1 minuto", +"%d minutes ago" => "hai %d minutos", +"today" => "hoxe", +"yesterday" => "onte", +"%d days ago" => "hai %d días", +"last month" => "último mes", +"months ago" => "meses atrás", +"last year" => "último ano", +"years ago" => "anos atrás", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s está dispoñible. Obteña <a href=\"%s\">máis información</a>", +"up to date" => "ao día", +"updates check is disabled" => "comprobación de actualizacións está deshabilitada" +); diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php new file mode 100644 index 00000000000..5fffeec2335 --- /dev/null +++ b/lib/l10n/ro.php @@ -0,0 +1,28 @@ +<?php $TRANSLATIONS = array( +"Help" => "Ajutor", +"Personal" => "Personal", +"Settings" => "Setări", +"Users" => "Utilizatori", +"Apps" => "Aplicații", +"Admin" => "Admin", +"ZIP download is turned off." => "Descărcarea ZIP este dezactivată.", +"Files need to be downloaded one by one." => "Fișierele trebuie descărcate unul câte unul.", +"Back to Files" => "Înapoi la fișiere", +"Selected files too large to generate zip file." => "Fișierele selectate sunt prea mari pentru a genera un fișier zip.", +"Application is not enabled" => "Aplicația nu este activată", +"Authentication error" => "Eroare la autentificare", +"Token expired. Please reload page." => "Token expirat. Te rugăm să reîncarci pagina.", +"seconds ago" => "secunde în urmă", +"1 minute ago" => "1 minut în urmă", +"%d minutes ago" => "%d minute în urmă", +"today" => "astăzi", +"yesterday" => "ieri", +"%d days ago" => "%d zile în urmă", +"last month" => "ultima lună", +"months ago" => "luni în urmă", +"last year" => "ultimul an", +"years ago" => "ani în urmă", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s este disponibil. Vezi <a href=\"%s\">mai multe informații</a>", +"up to date" => "la zi", +"updates check is disabled" => "verificarea după actualizări este dezactivată" +); diff --git a/lib/migrate.php b/lib/migrate.php index 823b3574f16..611a935ee5d 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -84,21 +84,15 @@ class OC_Migrate{ $types = array( 'user', 'instance', 'system', 'userfiles' ); if( !in_array( $type, $types ) ) { OC_Log::write( 'migration', 'Invalid export type', OC_Log::ERROR ); - return json_encode( array( array( 'success' => false ) ) ); + return json_encode( array( 'success' => false ) ); } self::$exporttype = $type; // Userid? if( self::$exporttype == 'user' ) { // Check user exists - if( !is_null($uid) ) { - $db = new OC_User_Database; - if( !$db->userExists( $uid ) ) { - OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR); - return json_encode( array( 'success' => false ) ); - } - self::$uid = $uid; - } else { - self::$uid = OC_User::getUser(); + self::$uid = is_null($uid) ? OC_User::getUser() : $uid; + if(!OC_User::userExists(self::$uid)){ + return json_encode( array( 'success' => false) ); } } // Calculate zipname diff --git a/lib/migration/content.php b/lib/migration/content.php index 64b8168cd98..89b1e782d86 100644 --- a/lib/migration/content.php +++ b/lib/migration/content.php @@ -30,7 +30,7 @@ class OC_Migration_Content{ // Holds the MDB2 object private $db=null; // Holds an array of tmpfiles to delete after zip creation - private $tmpfiles=false; + private $tmpfiles=array(); /** * @brief sets up the @@ -43,18 +43,21 @@ class OC_Migration_Content{ $this->zip = $zip; $this->db = $db; - if( !is_null( $db ) ) { - // Get db path - $db = $this->db->getDatabase(); - $this->tmpfiles[] = $db; - } - } // @brief prepares the db // @param $query the sql query to prepare public function prepare( $query ) { - + + // Only add database to tmpfiles if actually used + if( !is_null( $this->db ) ) { + // Get db path + $db = $this->db->getDatabase(); + if(!in_array($db, $this->tmpfiles)){ + $this->tmpfiles[] = $db; + } + } + // Optimize the query $query = $this->processQuery( $query ); diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 8596ea0b3c7..6428a883679 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -53,7 +53,7 @@ class OC_OCSClient{ /** * @brief Get all the categories from the OCS server * @returns array with category ids - * + * @note returns NULL if config value appstoreenabled is set to false * This function returns a list of all the application categories on the OCS server */ public static function getCategories() { |