The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug-fix/cosmetic releases?
#11
Carlos Wrote:my idea was reading all *.php filenames in the plugins folder to an array and compare with $live_plugins's keys using array_diff() ... (BTW I also think the function can be optimized a bit, so that it doesn't even generate the xml data if it's not going to be written to disk.)

Well, here's the possible patch. The xml data will only be generated and written to the plugins.xml file if any .php file has been added, removed or renamed (or if a plugin is activated/deactivated in admin>Plugins)

Replace whole function create_pluginsxml() in plugin_functions.php with:
Code:
function create_pluginsxml($force=false){
  global $live_plugins;  
  if (file_exists(GSPLUGINPATH)){
    $pluginfiles = getFiles(GSPLUGINPATH);
  }
  $phpfiles = array();
  foreach ($pluginfiles as $fi) {
    if (lowercase(pathinfo($fi, PATHINFO_EXTENSION))=='php') {
      $phpfiles[] = $fi;
    }
  }
  if (!$force) {
    $livekeys = array_keys($live_plugins);
    if (count(array_diff($livekeys, $phpfiles))>0 || count(array_diff($phpfiles, $livekeys))>0) {
      $force = true;
    }
  }
  if ($force) {
    $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
    foreach ($phpfiles as $fi) {
      $plugins = $xml->addChild('item');  
      $p_note = $plugins->addChild('plugin');
      $p_note->addCData($fi);
      $p_note = $plugins->addChild('enabled');
      if (isset($live_plugins[(string)$fi])){
        $p_note->addCData($live_plugins[(string)$fi]);    
      } else {
         $p_note->addCData('true');
      }
    }
    XMLsave($xml, GSDATAOTHERPATH."plugins.xml");
  }
  read_pluginsxml();
}

Please review and test before changing anything...

(Note that I have renamed a couple variables from the original function, $components and $c_note, I suppose Mike will agree...)
Reply


Messages In This Thread
Bug-fix/cosmetic releases? - by hameau - 2012-03-08, 01:20:22
Bug-fix/cosmetic releases? - by shawn_a - 2012-03-08, 03:37:07
Bug-fix/cosmetic releases? - by ccagle8 - 2012-03-08, 04:45:51
Bug-fix/cosmetic releases? - by Carlos - 2012-03-08, 05:38:22
Bug-fix/cosmetic releases? - by ccagle8 - 2012-03-08, 06:23:14
Bug-fix/cosmetic releases? - by Carlos - 2012-03-08, 07:45:58
Bug-fix/cosmetic releases? - by shawn_a - 2012-03-08, 11:47:10
Bug-fix/cosmetic releases? - by Carlos - 2012-03-08, 23:26:37
Bug-fix/cosmetic releases? - by ccagle8 - 2012-03-08, 23:27:35
Bug-fix/cosmetic releases? - by shawn_a - 2012-03-09, 00:47:31
Bug-fix/cosmetic releases? - by Carlos - 2012-03-10, 19:44:33
Bug-fix/cosmetic releases? - by Carlos - 2012-03-30, 03:08:20
Bug-fix/cosmetic releases? - by n00dles101 - 2012-03-30, 03:34:57
Bug-fix/cosmetic releases? - by Carlos - 2012-03-31, 23:31:37
Bug-fix/cosmetic releases? - by shawn_a - 2012-04-01, 00:36:43
Bug-fix/cosmetic releases? - by n00dles101 - 2012-04-03, 23:52:58



Users browsing this thread: 2 Guest(s)