diff options
author | Georg Ehrke <developer@georgehrke.com> | 2013-08-26 12:24:33 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2013-08-26 12:24:33 +0200 |
commit | 6f0c1e8d452ce6a0e843e219dbda0ede87f54a38 (patch) | |
tree | 6fed1f8c7854887e70970af24c56131ab83cb9f1 /lib | |
parent | 46cbd7cd3b37e073ebb497f34d54ab67e4761969 (diff) | |
parent | 653bc9a477a6f4833d9f34e1442d419cbb9429f8 (diff) | |
download | nextcloud-server-6f0c1e8d452ce6a0e843e219dbda0ede87f54a38.tar.gz nextcloud-server-6f0c1e8d452ce6a0e843e219dbda0ede87f54a38.zip |
Merge master into oc_preview
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.php | 17 | ||||
-rw-r--r-- | lib/installer.php | 53 | ||||
-rw-r--r-- | lib/l10n/eu.php | 8 | ||||
-rw-r--r-- | lib/l10n/he.php | 8 | ||||
-rw-r--r-- | lib/l10n/it.php | 8 |
5 files changed, 39 insertions, 55 deletions
diff --git a/lib/app.php b/lib/app.php index f76b92cde1b..8f5dd1d685e 100644 --- a/lib/app.php +++ b/lib/app.php @@ -210,7 +210,8 @@ class OC_App{ /** * @brief enables an app * @param mixed $app app - * @return bool + * @throws \Exception + * @return void * * This function set an app as enabled in appconfig. */ @@ -228,25 +229,25 @@ class OC_App{ } } } + $l = OC_L10N::get('core'); if($app!==false) { // check if the app is compatible with this version of ownCloud $info=OC_App::getAppInfo($app); $version=OC_Util::getVersion(); if(!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) { - OC_Log::write('core', - 'App "'.$info['name'].'" can\'t be installed because it is' - .' not compatible with this version of ownCloud', - OC_Log::ERROR); - return false; + throw new \Exception( + $l->t("App \"%s\" can't be installed because it is not compatible with this version of ownCloud.", + array($info['name']) + ) + ); }else{ OC_Appconfig::setValue( $app, 'enabled', 'yes' ); if(isset($appdata['id'])) { OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] ); } - return true; } }else{ - return false; + throw new \Exception($l->t("No app name specified")); } } diff --git a/lib/installer.php b/lib/installer.php index c29f9ec8982..b9684eaeea0 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -27,6 +27,7 @@ class OC_Installer{ /** * @brief Installs an app * @param $data array with all information + * @throws \Exception * @returns integer * * This function installs an app. All information needed are passed in the @@ -56,23 +57,22 @@ class OC_Installer{ * needed to get the app working. */ public static function installApp( $data = array()) { + $l = \OC_L10N::get('lib'); + if(!isset($data['source'])) { - OC_Log::write('core', 'No source specified when installing app', OC_Log::ERROR); - return false; + throw new \Exception($l->t("No source specified when installing app")); } //download the file if necesary if($data['source']=='http') { $path=OC_Helper::tmpFile(); if(!isset($data['href'])) { - OC_Log::write('core', 'No href specified when installing app from http', OC_Log::ERROR); - return false; + throw new \Exception($l->t("No href specified when installing app from http")); } copy($data['href'], $path); }else{ if(!isset($data['path'])) { - OC_Log::write('core', 'No path specified when installing app from local file', OC_Log::ERROR); - return false; + throw new \Exception($l->t("No path specified when installing app from local file")); } $path=$data['path']; } @@ -86,8 +86,7 @@ class OC_Installer{ rename($path, $path.'.tgz'); $path.='.tgz'; }else{ - OC_Log::write('core', 'Archives of type '.$mime.' are not supported', OC_Log::ERROR); - return false; + throw new \Exception($l->t("Archives of type %s are not supported", array($mime))); } //extract the archive in a temporary folder @@ -97,12 +96,11 @@ class OC_Installer{ if($archive=OC_Archive::open($path)) { $archive->extract($extractDir); } else { - OC_Log::write('core', 'Failed to open archive when installing app', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } - return false; + throw new \Exception($l->t("Failed to open archive when installing app")); } //load the info.xml file of the app @@ -118,62 +116,48 @@ class OC_Installer{ } } if(!is_file($extractDir.'/appinfo/info.xml')) { - OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } - return false; + throw new \Exception($l->t("App does not provide an info.xml file")); } $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); // check the code for not allowed calls if(!OC_Installer::checkCode($info['id'], $extractDir)) { - OC_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); - return false; + throw new \Exception($l->t("App can't be installed because of not allowed code in the App")); } // check if the app is compatible with this version of ownCloud 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); + !isset($info['require']) + or !OC_App::isAppVersionCompatible(OC_Util::getVersion(), $info['require']) + ) { OC_Helper::rmdirr($extractDir); - return false; + throw new \Exception($l->t("App can't be installed because it is not compatible with this version of ownCloud")); } // check if shipped tag is set which is only allowed for apps that are shipped with ownCloud if(isset($info['shipped']) and ($info['shipped']=='true')) { - OC_Log::write('core', - 'App can\'t be installed because it contains the <shipped>true</shippe>' - .' tag which is not allowed for non shipped apps', - OC_Log::ERROR); OC_Helper::rmdirr($extractDir); - return false; + throw new \Exception($l->t("App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps")); } // check if the ocs version is the same as the version in info.xml/version if(!isset($info['version']) or ($info['version']<>$data['appdata']['version'])) { - OC_Log::write('core', - 'App can\'t be installed because the version in info.xml/version is not the same' - .' as the version reported from the app store', - OC_Log::ERROR); OC_Helper::rmdirr($extractDir); - return false; + throw new \Exception($l->t("App can't be installed because the version in info.xml/version is not the same as the version reported from the app store")); } $basedir=OC_App::getInstallPath().'/'.$info['id']; //check if the destination directory already exists if(is_dir($basedir)) { - OC_Log::write('core', 'App directory already exists', OC_Log::WARN); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } - return false; + throw new \Exception($l->t("App directory already exists")); } if(isset($data['pretent']) and $data['pretent']==true) { @@ -182,12 +166,11 @@ class OC_Installer{ //copy the app to the correct place if(@!mkdir($basedir)) { - OC_Log::write('core', 'Can\'t create app folder. Please fix permissions. ('.$basedir.')', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } - return false; + throw new \Exception($l->t("Can't create app folder. Please fix permissions. %s", array($basedir))); } OC_Helper::copyr($extractDir, $basedir); diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php index 8f967314f4b..413819f4f94 100644 --- a/lib/l10n/eu.php +++ b/lib/l10n/eu.php @@ -40,13 +40,13 @@ $TRANSLATIONS = array( "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Zure web zerbitzaria ez dago oraindik ongi konfiguratuta fitxategien sinkronizazioa egiteko, WebDAV interfazea ongi ez dagoela dirudi.", "Please double check the <a href='%s'>installation guides</a>." => "Mesedez begiratu <a href='%s'>instalazio gidak</a>.", "seconds ago" => "segundu", -"_%n minute ago_::_%n minutes ago_" => array("",""), -"_%n hour ago_::_%n hours ago_" => array("",""), +"_%n minute ago_::_%n minutes ago_" => array("orain dela minutu %n","orain dela %n minutu"), +"_%n hour ago_::_%n hours ago_" => array("orain dela ordu %n","orain dela %n ordu"), "today" => "gaur", "yesterday" => "atzo", -"_%n day go_::_%n days ago_" => array("",""), +"_%n day go_::_%n days ago_" => array("orain dela egun %n","orain dela %n egun"), "last month" => "joan den hilabetean", -"_%n month ago_::_%n months ago_" => array("",""), +"_%n month ago_::_%n months ago_" => array("orain dela hilabete %n","orain dela %n hilabete"), "last year" => "joan den urtean", "years ago" => "urte", "Caused by:" => "Honek eraginda:", diff --git a/lib/l10n/he.php b/lib/l10n/he.php index bab1a6ff424..ced6244ee91 100644 --- a/lib/l10n/he.php +++ b/lib/l10n/he.php @@ -19,13 +19,13 @@ $TRANSLATIONS = array( "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "שרת האינטרנט שלך אינו מוגדר לצורכי סנכרון קבצים עדיין כיוון שמנשק ה־WebDAV כנראה אינו תקין.", "Please double check the <a href='%s'>installation guides</a>." => "נא לעיין שוב ב<a href='%s'>מדריכי ההתקנה</a>.", "seconds ago" => "שניות", -"_%n minute ago_::_%n minutes ago_" => array("",""), -"_%n hour ago_::_%n hours ago_" => array("",""), +"_%n minute ago_::_%n minutes ago_" => array("","לפני %n דקות"), +"_%n hour ago_::_%n hours ago_" => array("","לפני %n שעות"), "today" => "היום", "yesterday" => "אתמול", -"_%n day go_::_%n days ago_" => array("",""), +"_%n day go_::_%n days ago_" => array("","לפני %n ימים"), "last month" => "חודש שעבר", -"_%n month ago_::_%n months ago_" => array("",""), +"_%n month ago_::_%n months ago_" => array("","לפני %n חודשים"), "last year" => "שנה שעברה", "years ago" => "שנים", "Could not find category \"%s\"" => "לא ניתן למצוא את הקטגוריה „%s“" diff --git a/lib/l10n/it.php b/lib/l10n/it.php index e734fbdbb9b..983152a14ca 100644 --- a/lib/l10n/it.php +++ b/lib/l10n/it.php @@ -40,13 +40,13 @@ $TRANSLATIONS = array( "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Il tuo server web non è configurato correttamente per consentire la sincronizzazione dei file poiché l'interfaccia WebDAV sembra essere danneggiata.", "Please double check the <a href='%s'>installation guides</a>." => "Leggi attentamente le <a href='%s'>guide d'installazione</a>.", "seconds ago" => "secondi fa", -"_%n minute ago_::_%n minutes ago_" => array("",""), -"_%n hour ago_::_%n hours ago_" => array("",""), +"_%n minute ago_::_%n minutes ago_" => array("%n minuto fa","%n minuti fa"), +"_%n hour ago_::_%n hours ago_" => array("%n ora fa","%n ore fa"), "today" => "oggi", "yesterday" => "ieri", -"_%n day go_::_%n days ago_" => array("",""), +"_%n day go_::_%n days ago_" => array("%n giorno fa","%n giorni fa"), "last month" => "mese scorso", -"_%n month ago_::_%n months ago_" => array("",""), +"_%n month ago_::_%n months ago_" => array("%n mese fa","%n mesi fa"), "last year" => "anno scorso", "years ago" => "anni fa", "Caused by:" => "Causato da:", |