]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add a dependencies check apps
authorBrice Maron <brice@bmaron.net>
Fri, 28 Oct 2011 22:27:25 +0000 (00:27 +0200)
committerBrice Maron <brice@bmaron.net>
Fri, 28 Oct 2011 22:27:25 +0000 (00:27 +0200)
apps/dependencies_chk/appinfo/app.php [new file with mode: 0644]
apps/dependencies_chk/appinfo/info.xml [new file with mode: 0644]
apps/dependencies_chk/css/style.css [new file with mode: 0644]
apps/dependencies_chk/settings.php [new file with mode: 0644]
apps/dependencies_chk/templates/settings.php [new file with mode: 0644]

diff --git a/apps/dependencies_chk/appinfo/app.php b/apps/dependencies_chk/appinfo/app.php
new file mode 100644 (file)
index 0000000..dea2cd3
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+$l=new OC_L10N('dependencies_chk');
+
+OC_App::register( array( 
+  'order' => 14,
+  'id' => 'dependencies_chk',
+  'name' => 'Owncloud Install Info' ));
+
+OC_APP::registerAdmin('dependencies_chk','settings');
diff --git a/apps/dependencies_chk/appinfo/info.xml b/apps/dependencies_chk/appinfo/info.xml
new file mode 100644 (file)
index 0000000..38a6dee
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?> 
+<info>
+       <id>dependencies_chk</id>
+       <name>Owncloud dependencies info</name>
+       <version>0.01</version>
+       <licence>MIT</licence>
+       <author>Brice Maron (eMerzh)</author>
+       <require>2</require>
+       <description>Display OwnCloud's dependencies informations (missings modules, ...)</description>
+       <default_enable/>
+</info>
diff --git a/apps/dependencies_chk/css/style.css b/apps/dependencies_chk/css/style.css
new file mode 100644 (file)
index 0000000..30f204b
--- /dev/null
@@ -0,0 +1,9 @@
+#status_list legend { font-weight: bold; color: #888888; }
+.state > li { margin-bottom: 3px; padding-left: 0.5em; list-style-type: circle; }
+.state .state_module {  font-weight:bold; text-shadow: 0 1px 0 #DDD; cursor:help;}
+
+.state_used ul,  .state_used li { display:inline;   }
+
+.state_ok .state_module        { color: #009700; }
+.state_warning .state_module   { color: #FF9B29; }
+.state_error .state_module     { color: #FF3B3B; }
diff --git a/apps/dependencies_chk/settings.php b/apps/dependencies_chk/settings.php
new file mode 100644 (file)
index 0000000..ca60953
--- /dev/null
@@ -0,0 +1,91 @@
+<?php
+
+/**
+ * ownCloud - user_ldap
+ *
+ * @author Brice Maron
+ * @copyright 2011 Brice Maron brice __from__ bmaron _DOT_ net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+$l=new OC_L10N('dependencies_chk');
+$tmpl = new OC_Template( 'dependencies_chk', 'settings');
+
+$modules = array();
+
+//Possible status are : ok, error, warning
+$modules[] =array(
+       'status' => function_exists('json_encode') ? 'ok' : 'error',
+       'part'=> 'php-json',
+       'modules'=> array('core'),
+       'message'=> $l->t('The php-json module is needed by the many application for inter communications'));
+
+$modules[] =array(
+       'status' => function_exists('curl_init') ? 'ok' : 'error',
+       'part'=> 'php-curl',
+       'modules'=> array('bookmarks'),
+       'message'=> $l->t('The php-curl modude is needed to fetch the page title when adding a bookmarks'));
+
+$modules[] =array(
+       'status' => function_exists('imagepng') ? 'ok' : 'error',
+       'part'=> 'php-gd',
+       'modules'=> array('gallery'),
+       'message'=> $l->t('The php-gd module is needed to create thumbnails of your images'));
+
+$modules[] =array(
+       'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning',
+       'part'=> 'mp3info',
+       'modules'=> array('media'),
+       'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files'));
+
+$modules[] =array(
+       'status' => OC_Helper::canExecute("ldap_bind") ? 'ok' : 'error',
+       'part'=> 'php-ldap',
+       'modules'=> array('user_ldap'),
+       'message'=> $l->t('The php-ldap module is needed connect to your ldap server'));
+
+$modules[] =array(
+       'status' => class_exists('ZipArchive') ? 'ok' : 'warning',
+       'part'=> 'php-zip',
+       'modules'=> array('admin_export','core'),
+       'message'=> $l->t('The php-zip module is needed download multiple files at once'));
+
+$modules[] =array(
+       'status' => function_exists('mb_detect_encoding') ? 'ok' : 'error',
+       'part'=> 'php-mb_multibyte ',
+       'modules'=> array('core'),
+       'message'=> $l->t('The php-mb_multibyte module is needed to manage correctly the encoding.'));
+
+$modules[] =array(
+       'status' => function_exists('ctype_digit') ? 'ok' : 'error',
+       'part'=> 'php-ctype',
+       'modules'=> array('core'),
+       'message'=> $l->t('The php-ctype module is needed validate data.'));
+
+
+foreach($modules as $key => $module) {
+       $enabled = false ;
+       foreach($module['modules'] as $app) {
+               if(OC_App::isEnabled($app) || $app=='core'){
+                               $enabled = true;
+               }
+       }
+       if($enabled == false) unset($modules[$key]);
+}
+
+OC_UTIL::addStyle('dependencies_chk', 'style');
+$tmpl->assign( 'items', $modules );
+
+return $tmpl->fetchPage();
diff --git a/apps/dependencies_chk/templates/settings.php b/apps/dependencies_chk/templates/settings.php
new file mode 100644 (file)
index 0000000..8ff27eb
--- /dev/null
@@ -0,0 +1,16 @@
+<fieldset id="status_list" class="personalblock">
+       <legend><?php echo $l->t('Dependencies status');?></legend>
+       <ul class="state">
+               <?php foreach($_['items'] as $item):?>
+                       <li class="state_<?php echo $item['status'];?>">
+                               <span class="state_module" title="<?php echo $item['message'];?>"><?php echo $item['part'];?></span>
+                               <div class="state_used"><?php echo $l->t('Used by :');?>
+                                       <ul>
+                                               <?php foreach($item['modules'] as $module):?>
+                                                       <li><?php echo $module;?></li>
+                                               <?php endforeach;?>
+                                       </ul>
+                       </li>
+               <?php endforeach;?>
+       </ul>
+</fieldset>
\ No newline at end of file