Changeset 6977 for extensions/AMetaData


Ignore:
Timestamp:
Sep 20, 2010, 12:44:47 AM (14 years ago)
Author:
grum
Message:

Migration from version 0.4.0 to 0.5.1 implemented

Location:
extensions/AMetaData
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/admin/amd_install_page.tpl

    r6919 r6977  
    55  function submitForm()
    66  {
     7    $('#btSubmit').css('display', 'none');
     8    $('#iImgWait').css('display', 'block');
     9
    710    if($('#iInterfaceModeB').get(0).checked)
    811    {
     
    5558  </fieldset>
    5659
    57   <input type="button" onclick='submitForm();'  value="{'g003_validate'|@translate}">
     60  <input id='btSubmit' type="button" onclick='submitForm();'  value="{'g003_validate'|@translate}">
     61  <img id='iImgWait' src='./plugins/GrumPluginClasses/icons/processing.gif' style='display:none;margin-left:40px;'>
    5862
    5963</form>
  • extensions/AMetaData/admin/amd_metadata_tags.tpl

    r6950 r6977  
    2323              "{/literal}{'g003_number_of_keywords'|@translate}{literal} "+$("#iListTags table tr").length
    2424            );
     25
     26            if($("#iListTags table tr").length==0)
     27            {
     28              $('#iApply').css('display', 'none');
     29            }
     30            else
     31            {
     32              $('#iApply').css('display', 'block');
     33            }
    2534          }
    2635      }
     
    8291<div id="iListTagsNb"></div>
    8392
    84 <input type="button" value="{'g003_convert_keywords_and_apply'|@translate}" id='iApply' onclick='convertKeywordsList();'>
     93<input type="button" value="{'g003_convert_keywords_and_apply'|@translate}" id='iApply' onclick='convertKeywordsList();' style='display:none;'>
    8594
    8695<script type='text/javascript'>
  • extensions/AMetaData/admin/amd_metadata_tags_iKeywordsList.tpl

    r6950 r6977  
    88{/literal}
    99
    10 
     10{if count($datas)>0}
    1111<table class="littlefont listTags {$themeconf.name}" style="width:100%;">
    1212  {foreach from=$datas key=name item=data}
     
    2323  {/foreach}
    2424</table>
     25{else}
     26<br>
     27{'g003_no_keywords'|@translate}
     28{/if}
  • extensions/AMetaData/admin/plugin_admin.php

    r6919 r6977  
    2020if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
    2121
    22 global $prefixeTable;
     22global $prefixeTable, $template;
    2323
    2424load_language('plugin.lang', AMD_PATH);
     
    2626$main_plugin_object = get_plugin_data($plugin_id);
    2727
    28 /*
    29  * if the plugin is newly installed, display a special configuration page
    30  * otherwise, display normal page
    31  */
    3228
    33 $config=Array();
    34 GPCCore::loadConfig('amd', $config);
    3529
    36 if($config['newInstall']=='n')
     30
     31
     32if(CommonPlugin::checkGPCRelease(3,2,0))
    3733{
    38   include(AMD_PATH."amd_aip.class.inc.php");
    39   $plugin_ai = new AMD_AIP($prefixeTable, $main_plugin_object->getFileLocation());}
     34  $config=Array();
     35  GPCCore::loadConfig('amd', $config);
     36
     37
     38  if(!isset($config['installed'])) $config['installed']='00.04.00';
     39  if($config['installed']!=AMD_VERSION2)
     40  {
     41    /* the plugin was updated without being deactivated
     42     * deactivate + activate the plugin to process the database upgrade
     43     */
     44    include(AMD_PATH."amd_install.class.inc.php");
     45    $amd=new AMD_install($prefixeTable, dirname(__FILE__));
     46    $amd->deactivate();
     47    $amd->activate();
     48    $template->delete_compiled_templates();
     49    $config['newInstall']='n';
     50  }
     51
     52  /*
     53   * if the plugin is newly installed, display a special configuration page
     54   * otherwise, display normal page
     55   */
     56  if($config['newInstall']=='n')
     57  {
     58    include(AMD_PATH."amd_aip.class.inc.php");
     59    $plugin_ai = new AMD_AIP($prefixeTable, $main_plugin_object->getFileLocation());}
     60  else
     61  {
     62    include(AMD_PATH."amd_aip_install.class.inc.php");
     63    $plugin_ai = new AMD_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation());
     64  }
     65}
    4066else
    4167{
    42   include(AMD_PATH."amd_aip_install.class.inc.php");
    43   $plugin_ai = new AMD_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation());
     68  /*
     69   * plugin was upgraded, but GPC was not
     70   * display a page to inform user to upgrade GPC
     71   */
     72  include(AMD_PATH."amd_aip_release.class.inc.php");
     73  $plugin_ai = new AMD_AIPRelease($prefixeTable, $main_plugin_object->getFileLocation());
    4474}
    4575
    4676$plugin_ai->manage();
    4777
     78
     79
     80
    4881?>
  • extensions/AMetaData/amd_ajax.php

    r6950 r6977  
    15331533          }
    15341534        }
    1535         $sql="CREATE TEMPORARY TABLE amd_temp_tags (
    1536                 `value` CHAR(255) default '',
    1537                 `imageId` mediumint(8) unsigned NOT NULL default '0',
    1538                 PRIMARY KEY  USING BTREE (`value`,`imageId`)
    1539               ) CHARACTER SET utf8 COLLATE utf8_general_ci;";
    1540         if(pwg_query($sql))
    1541         {
    1542           $sql="INSERT IGNORE INTO amd_temp_tags
    1543             VALUES ".implode(',', $keywordsList);
     1535
     1536        if(count($keywordsList)>0)
     1537        {
     1538          $sql="CREATE TEMPORARY TABLE amd_temp_tags (
     1539                  `value` CHAR(255) default '',
     1540                  `imageId` mediumint(8) unsigned NOT NULL default '0',
     1541                  PRIMARY KEY  USING BTREE (`value`,`imageId`)
     1542                ) CHARACTER SET utf8 COLLATE utf8_general_ci;";
    15441543          if(pwg_query($sql))
    15451544          {
    1546             $sql="SELECT att.value AS value,
    1547                     COUNT(DISTINCT att.imageId) AS nbPictures,
    1548                     IF(ptt.name IS NULL, 'n', 'y') AS tagExists,
    1549                     COUNT(DISTINCT pit.image_id) AS nbPicturesTagged
    1550                   FROM (amd_temp_tags att LEFT JOIN ".TAGS_TABLE."  ptt ON att.value = ptt.name)
    1551                     LEFT JOIN ".IMAGE_TAG_TABLE." pit ON pit.tag_id = ptt.id
    1552                   GROUP BY att.value
    1553                   HAVING nbPicturesTagged < nbPictures";
    1554             $result=pwg_query($sql);
    1555             if($result)
     1545            $sql="INSERT IGNORE INTO amd_temp_tags
     1546              VALUES ".implode(',', $keywordsList);
     1547            if(pwg_query($sql))
    15561548            {
    1557               $i=0;
    1558               while($row=pwg_db_fetch_assoc($result))
     1549              $sql="SELECT att.value AS value,
     1550                      COUNT(DISTINCT att.imageId) AS nbPictures,
     1551                      IF(ptt.name IS NULL, 'n', 'y') AS tagExists,
     1552                      COUNT(DISTINCT pit.image_id) AS nbPicturesTagged
     1553                    FROM (amd_temp_tags att LEFT JOIN ".TAGS_TABLE."  ptt ON att.value = ptt.name)
     1554                      LEFT JOIN ".IMAGE_TAG_TABLE." pit ON pit.tag_id = ptt.id
     1555                    GROUP BY att.value
     1556                    HAVING nbPicturesTagged < nbPictures";
     1557              $result=pwg_query($sql);
     1558              if($result)
    15591559              {
    1560                 $row['id']=$i;
    1561                 $returned[]=$row;
    1562                 $i++;
     1560                $i=0;
     1561                while($row=pwg_db_fetch_assoc($result))
     1562                {
     1563                  $row['id']=$i;
     1564                  $returned[]=$row;
     1565                  $i++;
     1566                }
    15631567              }
    15641568            }
  • extensions/AMetaData/amd_install.class.inc.php

    r6919 r6977  
    2020
    2121  include_once('amd_root.class.inc.php');
    22   include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
    23 
    2422
    2523  class AMD_install extends AMD_root
     
    142140      }
    143141
    144 
     142      GPCCore::register($this->getPluginName(), AMD_VERSION, AMD_GPC_NEEDED);
    145143      return($result);
    146144    }
     
    154152      $this->deleteConfig();
    155153      $this->tablef->drop();
     154      GPCCore::unregister($this->getPluginName());
    156155    }
    157156
     
    162161      $this->initConfig();
    163162      $this->loadConfig();
    164       $this->loadConfigFromFile(dirname($this->getFileLocation()).'/activatePlugin.conf.php');
     163      if(method_exists($this, 'loadConfigFromFile'))
     164      {
     165        $this->loadConfigFromFile(dirname($this->getFileLocation()).'/activatePlugin.conf.php');
     166      }
    165167
    166168      /*
     
    173175      {
    174176        case '00.04.00':
     177          $this->config['newInstall']='n';
    175178          $this->updateFrom_000400();
    176179          break;
     
    187190      $this->config['installed']=AMD_VERSION2; //update the installed release number
    188191      $this->saveConfig();
     192
     193      GPCCore::register($this->getPluginName(), AMD_VERSION, AMD_GPC_NEEDED);
     194      GPCRequestBuilder::register($this->getPluginName(), dirname($this->getFileLocation()).'/amd_rb_callback.class.inc.php');
    189195    }
    190196
     
    192198    public function deactivate()
    193199    {
     200      GPCRequestBuilder::unregister($this->getPluginName());
    194201    }
    195202
     
    202209       * create new tables & alter existing tables
    203210       */
    204       $tableDef=array(
     211      $tablesCreate=array(
    205212"CREATE TABLE `".$this->tables['user_tags_label']."` (
    206213  `numId` INTEGER UNSIGNED NOT NULL,
     
    222229  KEY `byTagOrder` (`numId`,`order`)
    223230);",
    224 "ALTER TABLE `".$this->tables['images_tags']."`
    225   ADD COLUMN `numValue` DECIMAL(10,8)  DEFAULT NULL AFTER `value`,
    226   ADD INDEX `byNumId`(`numId`, `value`(35)),
    227   ADD INDEX `byNumId2`(`numId`, `numValue`)
    228 ;"
    229       );
    230       $tablesDef = create_table_add_character_set($tablesDef);
    231       $result=$this->tablef->create($tablesDef);
    232       unset($tablesDef);
    233 
    234       /*
    235        * update old tables
    236        */
    237 
    238       // no tables to update
     231      );
     232      $tablesUpdate=array(
     233        $this->tables['images_tags'] => array(
     234          'byNumId' => "ADD INDEX `byNumId`(`numId`, `value`(35))",
     235        )
     236      );
     237
     238      $tablesDef = create_table_add_character_set($tablesCreate);
     239
     240      $tablef=new GPCTables(array($this->tables['user_tags_label'], $this->tables['user_tags_def']));
     241
     242      if(count($tablesCreate)>0) $tablef->create($tablesCreate);
     243      if(count($tablesUpdate)>0) $tablef->updateTablesFields($tablesUpdate);
     244
     245      unset($tablesCreate);
     246      unset($tablesUpdate);
    239247    }
    240248
  • extensions/AMetaData/amd_version.inc.php

    r6950 r6977  
    1919  define('AMD_VERSION',  '0.5.1');
    2020  define('AMD_VERSION2', '00.05.01');
     21  define('AMD_GPC_NEEDED', '3.2.0');
    2122?>
  • extensions/AMetaData/language/en_UK/plugin.lang.php

    r5249 r6977  
    9898
    9999
    100 The information there are mainly technical: 
     100The information there are mainly technical:
    101101[ul]
    102102[li]equipment used (camera model, maker)[/li]
     
    116116$lang['g003_help_iptc'] = "IPTC Metadata consists of information the photographer can record in the image with an appropriate software.
    117117
    118 Information there is mainly oriented towards the professional world: 
     118Information there is mainly oriented towards the professional world:
    119119[ul]
    120120[li]photographer references (name, contact)[/li]
     
    167167[/ul]";
    168168
     169
     170
     171
     172/** ----------------------------------------------------------------------------
     173 * new keys from releases 0.5.0/0.5.1
     174 */
     175
     176$lang['g003_y'] = "Yes";
     177$lang['g003_n'] = "No";
     178
     179$lang['g003_state'] = "State";
     180$lang['g003_update'] = "Update";
     181$lang['g003_personnal'] = "User defined";
     182$lang['g003_search'] = "Search";
     183
     184$lang['g003_personnal_metadata'] = "User defined metadata";
     185$lang['g003_add_a_new_md'] = "Add a new metadata";
     186$lang['g003_fill_database'] = "Alimente le référentiel";
     187$lang['g003_num_of_rules'] = "Number of rules";
     188$lang['g003_metadatId'] = "Metadata ID";
     189$lang['g003_rules'] = "Rules";
     190$lang['g003_add_a_rule'] = "Add a rule";
     191$lang['g003_typeText'] = "Text";
     192$lang['g003_typeMetadata'] = "Metadata";
     193$lang['g003_typeCondition'] = "Condition";
     194$lang['g003_typeCIfExist'] = "exists";
     195$lang['g003_typeCIfNotExist'] = "don't exists";
     196$lang['g003_typeCIfEqual'] = "equals";
     197$lang['g003_typeCIfNotEqual'] = "is not equals";
     198$lang['g003_typeCIfLike'] = "like";
     199$lang['g003_typeCIfNotLike'] = "don't like";
     200$lang['g003_typeCIfBeginWith'] = "begin with";
     201$lang['g003_typeCIfNotBeginWith'] = "don't begin with";
     202$lang['g003_typeCIfEndWith'] = "end with";
     203$lang['g003_typeCIfNotEndWith'] = "don't end with";
     204$lang['g003_conditionIf'] = "Test if the metadata value";
     205
     206$lang['g003_invalidId'] = "Metadata ID isn\'t valid";
     207$lang['g003_oneRuleIsNeeded'] = "At least, one rule is mandatory";
     208$lang['g003_textRuleInvalid'] = "Rule of type \"Text\" : a value is mandatory";
     209$lang['g003_metadataRuleInvalid'] = "Rule of type \"Metadata\" : a metadata must be selected";
     210$lang['g003_conditionMdRuleInvalid'] = "Règle of type \"Condition\" : a metadata must be selected";
     211$lang['g003_conditionRulesRuleInvalid'] = "Règle of type \"Condition\" : a least, one rule is mandatory";
     212
     213$lang['g003_tagIdAlreadyExist'] = "A metadata with this ID already exists !";
     214
     215$lang['g003_pleaseConfirmMetadataDelete'] = "Please confirm deleting the metadata";
     216$lang['g003_deleteMetadata'] = "Deleting a metadata";
     217$lang['g003_delete']= "Delete";
     218
     219$lang['g003_userDefined_filter'] = "User defined metadata";
     220
     221$lang['g003_informations'] = "Informations";
     222$lang['g003_databaseInformation'] = "Informations importantes à propos du référentiel";
     223$lang['g003_databaseWarning1']="[p]Le référentiel est constitué des métadonnées contenues dans les images de la galerie ainsi que de métadonnées calculées par le plugin. En fonction du nombre d'images et du nombre de métadonnées y étant rattachées, le référentiel peut s'avérer être très volumineux.
     224Avant d'alimenter le référentiel, assurez-vous que la base de données proposée par votre hébergeur permet ce type d'usage.
     225[/p][p]Il est toutefois à noter que l'usage du référentiel est facultatif, ce dernier n'étant pas exploité pour l'affichage des métadonnées des photos de la galerie.
     226[/p][p]L'alimentation du référentiel est nécessaire si vous souhaitez :[/p]
     227[ul]
     228[li]Disposer de statistiques sur les métadonnées présentes dans vos photos (c'est aussi une aide pour la sélection de métadonnées)[/li]
     229[li]Disposer du moteur de recherche[/li]
     230[/ul]
     231";
     232$lang['g003_sizeAndRows'] = "The database weight do %s and have %s metadata";
     233$lang['g003_numberOfAnalyzedPictures'] = "%d images were analyzed";
     234
     235$lang['g003_options'] = "Options";
     236$lang['g003_fillDatabaseContinuously'] = "Fill the database continuously";
     237$lang['g003_ignoreMetadata'] = "Ignore the metadata :";
     238
     239$lang['g003_analyze_analyzed_pictures'] = "Analyze is made only on pictures already analyzed";
     240$lang['g003_fillDatabaseIgnoreWarning'] = "To be applied, the modified settings needs to made a new database analyze";
     241
     242
     243$lang['g003_add_metadata'] = "Add a metadata";
     244
     245$lang['g003_choose_a_metadata'] = "Search on a metadata value";
     246$lang['g003_add'] = "Ajouter";
     247$lang['g003_metadata_value_check_one'] = "Au moins une des valeurs suivantes doit être vérifiée :";
     248$lang['g003_metadata_value_check_all'] = "Toutes les valeurs suivantes doivent être vérifiées :";
     249
     250$lang['g003_metadata_exists']="La métadonnée %s est présente";
     251$lang['g003_metadata_dont_exists']="La métadonnée %s n'est pas présente";
     252$lang['g003_metadata_equals_all']="La métadonnée %s est présente et est égale à l\'une des valeurs suivantes :";
     253$lang['g003_metadata_equals_one']="La métadonnée %s est présente et est égale à la valeur suivante :";
     254$lang['g003_metadata_not_equals_all']="La métadonnée %s est présente et n'est égale à aucune des valeurs suivantes :";
     255$lang['g003_metadata_not_equals_one']="La métadonnée %s est présente et n'est pas égale à la valeur suivante :";
     256$lang['g003_metadata_like_all']="La métadonnée %s est présente et contient l\'une des valeurs suivantes :";
     257$lang['g003_metadata_like_one']="La métadonnée %s est présente et contient la valeur suivante :";
     258$lang['g003_metadata_not_like_all']="La métadonnée %s est présente et ne contient aucune des valeurs suivantes :";
     259$lang['g003_metadata_not_like_one']="La métadonnée %s est présente et n'est contient pas la valeur suivante :";
     260$lang['g003_metadata_begin_all']="La métadonnée %s est présente et commence par l\'une des valeurs suivantes :";
     261$lang['g003_metadata_begin_one']="La métadonnée %s est présente et commence par la valeur suivante :";
     262$lang['g003_metadata_not_begin_all']="La métadonnée %s est présente et ne commence pas par l\'une des valeurs suivantes :";
     263$lang['g003_metadata_not_begin_one']="La métadonnée %s est présente et ne commence pas par la valeur suivante :";
     264$lang['g003_metadata_end_all']="La métadonnée %s est présente et finit par l\'une des valeurs suivantes :";
     265$lang['g003_metadata_end_one']="La métadonnée %s est présente et finit par la valeur suivante :";
     266$lang['g003_metadata_not_end_all']="La métadonnée %s est présente et ne finit pas par l\'une des valeurs suivantes :";
     267$lang['g003_metadata_not_end_one']="La métadonnée %s est présente et ne finit pas par la valeur suivante :";
     268
     269$lang['g003_value_already_set'] = "La valeur est déjà définie dans le domaine de valeurs";
     270$lang['g003_please_set_a_value'] = "Merci de définir une valeur";
     271
     272
     273$lang['g003_install']="Installation";
     274$lang['g003_basic_mode']="Basic";
     275$lang['g003_advanced_mode']="Advanced";
     276$lang['g003_validate']="Validate";
     277$lang['g003_step_1']="Choix du type d'usage du plugin";
     278$lang['g003_basic_mode_help']="
     279Le mode [i]basique[/i] s'adresse à ceux qui souhaitent simplement afficher les métadonnées de leurs photos et propose :[ul]
     280[li]une interface simplifiée au maximum[/li]
     281[li]une liste réduite de métadonnées (environ 140, dont les plus courantes)[/li]
     282[/ul]";
     283$lang['g003_advanced_mode_help']="
     284Le mode [i]avancé[/i] s'adresse à ceux qui souhaitent exploiter au maximum les métadonnées de leurs photos et propose :[ul]
     285[li]une interface plus complexe, mais complète[/li]
     286[li]une liste de métadonnées plus complète (environ 540)[/li]
     287[li]des fonctionnalités étendues (statistiques, recherche, ...)[/li]
     288[/ul]
     289Le mode [i]avancé[/i] nécessite la constitution d'un référentiel.";
     290
     291
     292/** ----------------------------------------------------------------------------
     293 * removed keys from releases 0.5.0/0.5.1
     294 */
     295//$lang['g003_warning_on_analyze_4a']
     296//$lang['g003_warning_on_analyze_4b']
     297
     298
     299
     300
     301
     302
    169303?>
  • extensions/AMetaData/language/fr_FR/plugin.lang.php

    r6950 r6977  
    294294$lang['g003_convert_ok']="La conversion s'est correctement effectuée";
    295295$lang['g003_convert_keywords_and_apply']="Convertir";
     296$lang['g003_no_keywords']="Aucun mot-clef susceptible d'être convertit n'a pu être trouvé.";
    296297
    297298
     
    322323Sélections&tris sont pris en compte immédiatement (il n'est pas nécessaire de les valider).";
    323324
     325$lang['g003_gpc_not_up_to_date']="Il est nécessaire que le plugin <i>Grum Plugin Classes</i> version %s soit installé.
     326Actuellement, la version %s est installée : merci de procéder à la mise à jour de version du plugin <i>Grum Plugin Classes</i>.";
    324327
    325328/** ----------------------------------------------------------------------------
  • extensions/AMetaData/main.inc.php

    r6950 r6977  
    6363|         |            |   . Make test images lighter
    6464|         |            |     The weight of tests images provided with the
    65 |         |            |     JpegMetadata class was to heavy ; the file size has
    66 |         |            |     been reduced from 9Mb to 230Kb
     65|         |            |     JpegMetadata class was too heavy ; the file size
     66|         |            |     has been reduced from 9Mb to 230Kb
    6767|         |            |
    6868|         |            | * mantis : feature 1688
     
    182182else
    183183{
    184   //AMD public part loaded and active only if in public page
    185   include_once("amd_pip.class.inc.php");
    186   $obj = new AMD_PIP($prefixeTable, __FILE__);
    187   set_plugin_data($plugin['id'], $obj);
     184  //AMD public part loaded and active only if in public page and if GPC is up to date
     185  if(CommonPlugin::checkGPCRelease(3,2,0))
     186  {
     187    include_once("amd_pip.class.inc.php");
     188    $obj = new AMD_PIP($prefixeTable, __FILE__);
     189    set_plugin_data($plugin['id'], $obj);
     190  }
    188191}
    189192
  • extensions/AMetaData/maintain.inc.php

    r6891 r6977  
    2929
    3030
    31 global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
     31global $gpcInstalled, $lang; //needed for plugin manager compatibility
    3232
    3333/* -----------------------------------------------------------------------------
    3434 * AMD needs the Grum Plugin Classe
    3535 * -------------------------------------------------------------------------- */
    36 $gpc_installed=false;
    37 $gpcNeeded="3.2.0";
     36$gpcInstalled=false;
    3837if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    3938{
     
    4342  {
    4443    @include_once("amd_install.class.inc.php");
    45     $gpc_installed=true;
     44    $gpcInstalled=true;
    4645  }
    4746}
     
    4948function gpcMsgError(&$errors)
    5049{
    51   global $gpcNeeded;
    52   $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     50  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), AMD_GPC_NEEDED);
    5351  if(is_array($errors))
    5452  {
     
    6866function plugin_install($plugin_id, $plugin_version, &$errors)
    6967{
    70   global $prefixeTable, $gpc_installed, $gpcNeeded;
    71   if($gpc_installed)
     68  global $prefixeTable, $gpcInstalled;
     69  if($gpcInstalled)
    7270  {
    7371    $amd=new AMD_install($prefixeTable, __FILE__);
    7472    $result=$amd->install();
    75     GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded);
    7673  }
    7774  else
     
    8380function plugin_activate($plugin_id, $plugin_version, &$errors)
    8481{
    85   global $prefixeTable, $gpcNeeded;
    86 
    87   $amd=new AMD_install($prefixeTable, __FILE__);
    88   $result=$amd->activate();
    89   GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded);
    90   GPCRequestBuilder::register($amd->getPluginName(), dirname($amd->getFileLocation()).'/amd_rb_callback.class.inc.php');
     82  global $prefixeTable, $gpcInstalled;
     83  if($gpcInstalled)
     84  {
     85    $amd=new AMD_install($prefixeTable, __FILE__);
     86    $result=$amd->activate();
     87  }
    9188}
    9289
    9390function plugin_deactivate($plugin_id)
    9491{
    95   global $prefixeTable, $gpcNeeded;
     92  global $prefixeTable, $gpcInstalled;
    9693
    97   $amd=new AMD_install($prefixeTable, __FILE__);
    98   GPCRequestBuilder::unregister($amd->getPluginName());
     94  if($gpcInstalled)
     95  {
     96    $amd=new AMD_install($prefixeTable, __FILE__);
     97    $amd->deactivate();
     98  }
    9999}
    100100
    101101function plugin_uninstall($plugin_id)
    102102{
    103   global $prefixeTable, $gpc_installed, $gpcNeeded;
    104   if($gpc_installed)
     103  global $prefixeTable, $gpcInstalled;
     104  if($gpcInstalled)
    105105  {
    106106    $amd=new AMD_install($prefixeTable, __FILE__);
    107107    $result=$amd->uninstall();
    108     GPCCore::unregister($amd->getPluginName());
    109108  }
    110109  else
Note: See TracChangeset for help on using the changeset viewer.