Ignore:
Timestamp:
Jun 29, 2014, 4:23:36 PM (10 years ago)
Author:
mistic100
Message:

use new maintain class

File:
1 edited

Legend:

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

    r26199 r28844  
    1717define('INSTAG_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . INSTAG_ID);
    1818define('INSTAG_FS_CACHE', $conf['data_location'].'instagram_cache/');
    19 define('INSTAG_VERSION',  'auto');
    20 
    2119
    2220include_once(INSTAG_PATH . 'include/ws_functions.inc.php');
    2321
    2422
    25 add_event_handler('init', 'instagram_init');
     23$conf['Instagram2Piwigo'] = safe_unserialize($conf['Instagram2Piwigo']);
     24
     25
    2626add_event_handler('ws_add_methods', 'instagram_add_ws_method');
    2727
     
    3232  add_event_handler('get_batch_manager_prefilters', 'instagram_add_batch_manager_prefilters');
    3333  add_event_handler('perform_batch_manager_prefilters', 'instagram_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    34 
    35   function instagram_admin_menu($menu)
    36   {
    37     $menu[] = array(
    38       'NAME' => 'Instagram2Piwigo',
    39       'URL' => INSTAG_ADMIN,
    40       );
    41     return $menu;
    42   }
    43  
    44   function instagram_add_batch_manager_prefilters($prefilters)
    45   {
    46     $prefilters[] = array(
    47       'ID' => 'instagram',
    48       'NAME' => l10n('Imported from Instagram'),
    49       );
    50     return $prefilters;
    51   }
    52 
    53   function instagram_perform_batch_manager_prefilters($filter_sets, $prefilter)
    54   {
    55     if ($prefilter == 'instagram')
    56     {
    57       $query = '
    58   SELECT id
    59     FROM '.IMAGES_TABLE.'
    60     WHERE file LIKE "instagram-%"
    61   ;';
    62       $filter_sets[] = array_from_query($query, 'id');
    63     }
    64    
    65     return $filter_sets;
    66   }
    6734}
    6835
    6936
    70 function instagram_init()
     37function instagram_admin_menu($menu)
    7138{
    72   global $conf;
     39  $menu[] = array(
     40    'NAME' => 'Instagram2Piwigo',
     41    'URL' => INSTAG_ADMIN,
     42    );
     43  return $menu;
     44}
    7345
    74   include_once(INSTAG_PATH . 'maintain.inc.php');
    75   $maintain = new instagram2piwigo_maintain(INSTAG_ID);
    76   $maintain->autoUpdate(INSTAG_VERSION, 'install');
     46function instagram_add_batch_manager_prefilters($prefilters)
     47{
     48  $prefilters[] = array(
     49    'ID' => 'instagram',
     50    'NAME' => l10n('Imported from Instagram'),
     51    );
     52  return $prefilters;
     53}
    7754
    78   $conf['Instagram2Piwigo'] = unserialize($conf['Instagram2Piwigo']);
     55function instagram_perform_batch_manager_prefilters($filter_sets, $prefilter)
     56{
     57  if ($prefilter == 'instagram')
     58  {
     59    $query = '
     60SELECT id
     61  FROM '.IMAGES_TABLE.'
     62  WHERE file LIKE "instagram-%"
     63;';
     64    $filter_sets[] = array_from_query($query, 'id');
     65  }
     66 
     67  return $filter_sets;
    7968}
Note: See TracChangeset for help on using the changeset viewer.