[ PHPXref.com ] [ Generated: Sun Jul 20 21:11:51 2008 ] [ XOOPS 2.2.3a ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/html/ -> xoopsupdate.php (source)

   1  <?php
   2  include  "mainfile.php";
   3  if (isset($_POST['submit'])) {
   4      //Check for duplicate configuration items:

   5      $sql = "SELECT c1.conf_id FROM ".$xoopsDB->prefix('config')." c1, ".$xoopsDB->prefix('config')." c2 WHERE
   6                  c1.conf_modid=c2.conf_modid AND c1.conf_name=c2.conf_name AND c1.conf_id > c2.conf_id";
   7      $result = $xoopsDB->query($sql);
   8      while (list($id) = $xoopsDB->fetchRow($result)) {
   9          $ids[] = $id;
  10      }
  11      if (count($ids) > 0) {
  12          $criteria = new Criteria('conf_id', "(".implode(',', $ids).")", "IN");
  13          $config_handler = xoops_gethandler('config');
  14          $configs = $config_handler->getConfigs($criteria);
  15          foreach (array_keys($configs) as $i) {
  16              $config_handler->deleteConfig($configs[$i]);
  17          }
  18      }
  19  
  20      //Update system

  21      include  XOOPS_ROOT_PATH."/modules/system/include/update.php";
  22      $module_handler = xoops_gethandler('module');
  23      $module = $module_handler->getByDirname("system");
  24  
  25      include  XOOPS_ROOT_PATH."/modules/system/language/english/admin/modulesadmin.php";
  26      $module->update();
  27  
  28      $criteria = new CriteriaCompo(new Criteria("hasconfig", 1));
  29      $criteria->add(new Criteria('dirname', "system", "!="));
  30      $modules_with_config = $module_handler->getObjects($criteria);
  31      unset($criteria);
  32      if (count($modules_with_config) > 0) {
  33          $msgs = array();
  34          foreach (array_keys($modules_with_config) as $i) {
  35              $modules_with_config[$i]->insertConfigCategories();
  36              $modules_with_config[$i]->insertConfig();
  37              $msgs = array_merge($msgs, $modules_with_config[$i]->getMessages());
  38          }
  39          echo implode('<br />', $msgs);
  40      }
  41  
  42  }
  43  else {
  44      $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix('config')." SET conf_modid=1 WHERE conf_modid=0"); //Shouldn't really be run several times, but it doesn't hurt anything since there will be no configs with conf_modid=0

  45      include_once  XOOPS_ROOT_PATH."/class/xoopsformloader.php";
  46      $form = new XoopsThemeForm('Update XOOPS', 'form', 'xoopsupdate.php');
  47      $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
  48      $form->display();
  49  }
  50  include  "footer.php";
  51  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]