Ignore:
Timestamp:
May 13, 2010, 12:06:29 PM (14 years ago)
Author:
patdenice
Message:

Upgrade work for 2.1.
Language keys have not been inserted yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/main.inc.php

    r4711 r6167  
    1111if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1212
    13 if (script_basename() == 'admin') add_event_handler('get_admin_plugin_menu_links', 'check_for_auto_upgrade');
     13define('AUTOUPDATE_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
     14
     15if (script_basename() == 'admin')
     16 add_event_handler('get_admin_plugin_menu_links', 'check_for_auto_upgrade');
    1417
    1518function check_for_auto_upgrade($plugin_menu_links)
    1619{
    17   global $template, $page, $conf, $header_notes;
     20  global $template, $page, $conf, $header_notes, $prefixeTable;
    1821
    1922  if ($page['page'] == 'intro')
    2023  {
    21     include(dirname(__FILE__).'/autoupdate.php');
     24    if (isset($_GET['action']) and
     25      ($_GET['action'] == 'check_autoupdate' or $_GET['action'] == 'check_upgrade' ))
     26    {
     27      unset($_SESSION['need_update']);
     28      unset($_SESSION['plugins_need_update']);
     29    }
     30
     31    if (!isset($_SESSION['need_update']) or !isset($_SESSION['plugins_need_update'])
     32      or $_SESSION['need_update'] !== false or $_SESSION['plugins_need_update'] !== array())
     33    {
     34      $template->set_filename('autoupdate_head', realpath(AUTOUPDATE_PATH.'template/head.tpl'));
     35      array_push($header_notes, $template->parse('autoupdate_head', true));
     36    }
    2237  }
    2338
    24   if ($page['page'] == 'plugins_update')
     39  if ($page['page'] == 'plugins_update' and method_exists('template', 'set_prefilter'))
    2540  {
    2641    include(dirname(__FILE__).'/plugins_update.php');
    2742  }
    2843
     44  array_push($plugin_menu_links, array(
     45      'NAME' => 'Piwigo AutoUpgrade',
     46      'URL' => get_admin_plugin_menu_link(AUTOUPDATE_PATH . '/autoupdate.php')));
     47
    2948  return $plugin_menu_links;
    3049}
Note: See TracChangeset for help on using the changeset viewer.