]> git.mxchange.org Git - friendica.git/blobdiff - include/plugin.php
Sending mail as multipart/alternative (html and plain text) (very basic by now)
[friendica.git] / include / plugin.php
old mode 100644 (file)
new mode 100755 (executable)
index 9f28329..85b51ed
@@ -19,7 +19,7 @@ function uninstall_plugin($plugin){
 if (! function_exists('install_plugin')){
 function install_plugin($plugin){
        logger("Addons: installing " . $plugin);
-       $t = filemtime('addon/' . $plugin . '/' . $plugin . '.php');
+       $t = @filemtime('addon/' . $plugin . '/' . $plugin . '.php');
        @include_once('addon/' . $plugin . '/' . $plugin . '.php');
        if(function_exists($plugin . '_install')) {
                $func = $plugin . '_install';
@@ -33,6 +33,10 @@ function install_plugin($plugin){
                        $plugin_admin
                );
        }
+       else {
+               logger("Addons: FAILED installing " . $plugin);
+       }
+
 }}
 
 // reload all updated plugins
@@ -52,25 +56,29 @@ function reload_plugins() {
                if(count($parr)) {
                        foreach($parr as $pl) {
                                $pl = trim($pl);
+
+                               $fname = 'addon/' . $pl . '/' . $pl . '.php';
                                
-                               $t = filemtime('addon/' . $pl . '/' . $pl . '.php');
-                               foreach($installed as $i) {
-                                       if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {    
-                                               logger('Reloading plugin: ' . $i['name']);
-                                               @include_once('addon/' . $pl . '/' . $pl . '.php');
-
-                                               if(function_exists($pl . '_uninstall')) {
-                                                       $func = $pl . '_uninstall';
-                                                       $func();
-                                               }
-                                               if(function_exists($pl . '_install')) {
-                                                       $func = $pl . '_install';
-                                                       $func();
+                               if(file_exists($fname)) {
+                                       $t = @filemtime($fname);
+                                       foreach($installed as $i) {
+                                               if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {    
+                                                       logger('Reloading plugin: ' . $i['name']);
+                                                       @include_once($fname);
+
+                                                       if(function_exists($pl . '_uninstall')) {
+                                                               $func = $pl . '_uninstall';
+                                                               $func();
+                                                       }
+                                                       if(function_exists($pl . '_install')) {
+                                                               $func = $pl . '_install';
+                                                               $func();
+                                                       }
+                                                       q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1",
+                                                               intval($t),
+                                                               intval($i['id'])
+                                                       );
                                                }
-                                               q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1",
-                                                       intval($t),
-                                                       intval($i['id'])
-                                               );
                                        }
                                }
                        }