This commit is contained in:
friendica 2012-02-09 22:44:59 -08:00
parent ffe7d8b1e9
commit 2f2e331c33

View file

@ -57,24 +57,28 @@ function reload_plugins() {
foreach($parr as $pl) { foreach($parr as $pl) {
$pl = trim($pl); $pl = trim($pl);
$t = filemtime('addon/' . $pl . '/' . $pl . '.php'); $fname = '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')) { if(file_exists($fname)) {
$func = $pl . '_uninstall'; $t = @filemtime($fname);
$func(); 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'])
);
} }
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'])
);
} }
} }
} }