[geeklog-cvs] geeklog: Merging
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Mar 27 13:25:14 EDT 2011
changeset 8202:72bece737ac6
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/72bece737ac6
user: Dirk Haun <dirk at haun-online.de>
date: Sun Mar 27 17:46:43 2011 +0200
description:
Merging
diffstat:
system/lib-plugins.php | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
diffs (62 lines):
diff -r 4b6f4ab2ec3d -r 72bece737ac6 system/lib-plugins.php
--- a/system/lib-plugins.php Sun Mar 27 17:46:22 2011 +0200
+++ b/system/lib-plugins.php Sun Mar 27 17:46:43 2011 +0200
@@ -2781,27 +2781,33 @@
// automatically resolve load order for enabled plugins
$index = 2000; // how far through the load order to push back plugins
$maxqueries = 50; // just in case...
- $globalflag = false; // rememebr if we change the load order of any plugin
+ $globalflag = false; // remember if we change the load order of any plugin
$flag = true; // set true if we need another pass in the while loop
- while ($flag && $maxqueries) {
+ while ($flag && $maxqueries) { // Now check if the load order is correct
$flag = false;
- // Now check if the load order is correct
+ // get the load orders of all enabled plugins
+ $q = DB_query("SELECT pi_name, pi_load FROM {$_TABLES['plugins']} WHERE pi_enabled='1'");
+ $plo = array(); // Plugins Load Order
+ while ($a = DB_fetchArray($q)) {
+ $plo[] = $a;
+ }
$params = array();
- foreach ($_PLUGINS as $key => $pi_name) {
+ foreach ($plo as $key => $value) { // for each available plugin
$maxqueries--;
- $params = PLG_getParams($pi_name);
- if (isset($params['requires']) && is_array($params['requires'])) {
- // load order of the plugin
- $p = DB_query("SELECT pi_load FROM {$_TABLES['plugins']} WHERE pi_name='{$pi_name}'");
- $p = DB_fetchArray($p);
- foreach ($params['requires'] as $rkey => $rvalue) {
+ $params = PLG_getParams($value['pi_name']); // get dependencies
+ if (isset($params['requires']) && is_array($params['requires'])) { // if any
+ foreach ($params['requires'] as $rkey => $rvalue) { // process each dependency
if (isset($rvalue['plugin'])) {
- // load order of the dependency
- $q = DB_query("SELECT pi_load FROM {$_TABLES['plugins']} WHERE pi_name='{$rvalue['plugin']}'");
- $q = DB_fetchArray($q);
- if ( $q['pi_load'] > $p['pi_load'] ) { // incorrect load order
+ // get the load order of the required plugin
+ foreach ($plo as $new_key => $new_value) {
+ if ($new_value['pi_name'] == $rvalue['plugin']) {
+ $dep_load = $new_value['pi_load'];
+ break;
+ }
+ }
+ if ( $dep_load > $value['pi_load'] ) { // incorrect load order
// move down the order
- DB_query("UPDATE {$_TABLES['plugins']} SET pi_load = '{$index}' WHERE pi_name = '{$pi_name}'");
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_load = '{$index}' WHERE pi_name = '{$value['pi_name']}'");
$index++;
$flag = true;
$globalflag = true;
@@ -2810,8 +2816,8 @@
}
}
}
- reorderplugins();
}
+ reorderplugins();
if ($globalflag == false) {
return true; // no change
} else {
More information about the geeklog-cvs
mailing list