Ignore:
Timestamp:
Oct 20, 2010, 10:49:29 PM (14 years ago)
Author:
grum
Message:

fix bug and implement new features
bug:1926, bug:1927, bug:1929, bug:1930, bug:1931, bug:1939, bug:1946

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/gmaps_install.class.inc.php

    r7177 r7308  
    4141    public function install()
    4242    {
     43      if(!file_exists(GPCCore::getPiwigoSystemPath().self::KML_DIRECTORY))
     44      {
     45        mkdir(GPCCore::getPiwigoSystemPath().self::KML_DIRECTORY, 0755, true);
     46      }
     47
    4348      $this->initConfig();
    4449      $this->loadConfig();
     
    6267  `streetViewControl` char(1) NOT NULL default 'n',
    6368  `style` varchar(512) NOT NULL,
     69  `zoomLevelMaxActivated` char(1) NOT NULL default 'n',
    6470  PRIMARY KEY  (`id`)
    6571)",
     
    131137      switch($this->config['installed'])
    132138      {
    133         // actually, there no migration possible from previous release
     139        case '01.00.00';
     140          $this->updateFrom_010000();
    134141        default:
    135142          // nothing to do...
     
    150157    }
    151158
     159
     160    /**
     161     * update from release 1.0.0
     162     *
     163     *  - create the /local/plugins/GMaps/kml directory
     164     *  - move kml files from /plugins/GMaps/kml directory to the new directory
     165     *  - remove the /plugins/GMaps/kml directory
     166     */
     167    private function updateFrom_010000()
     168    {
     169      mkdir(GPCCore::getPiwigoSystemPath().self::KML_DIRECTORY, 0755, true);
     170
     171      $directory=scandir(GMAPS_PATH.'kml/');
     172      foreach($directory as $file)
     173      {
     174        $ext=(pathinfo($file, PATHINFO_EXTENSION));
     175        if(preg_match('/.*(?:\.kml|\.kmz)$/i', $file))
     176        {
     177          rename(GMAPS_PATH.'kml/'.$file, GPCCore::getPiwigoSystemPath().self::KML_DIRECTORY.$file);
     178        }
     179      }
     180
     181      mkdir(GPCCore::getPiwigoSystemPath().self::KML_DIRECTORY);
     182
     183
     184      $tablesUpdate=array(
     185        $this->tables['images_tags'] => array(
     186          'zoomLevelMaxActivated' => " ADD COLUMN `zoomLevelMaxActivated` CHAR(1)  NOT NULL DEFAULT 'n' AFTER `style` ",
     187        )
     188      );
     189
     190      $tablef=new GPCTables(array($this->tables['maps']));
     191      $tablef->updateTablesFields($tablesUpdate);
     192
     193      unset($tablesUpdate);
     194    }
     195
    152196  } //class
    153197
Note: See TracChangeset for help on using the changeset viewer.