Esempio n. 1
0
 /**
  * Update wireless metadata for packages that were created prior to 6.6 but
  * are being installed or deployed in 6.6+
  */
 public function update_wireless_metadata()
 {
     // If there was a copy to path then we can work it
     if (isset($this->installdefs['copy'])) {
         // Add in Sidecar upgrader after old style metadata changes are brought over
         $sidecarUpgrader = new SidecarMetaDataUpgrader();
         // Let the upgrader know that this is from installation
         $sidecarUpgrader->fromInstallation = true;
         // Turn off writing to log
         $sidecarUpgrader->toggleWriteToLog();
         // Get our files in the $cp['to'] path to upgrade
         foreach ($this->installdefs['copy'] as $cp) {
             // Set the files array
             $files = array();
             // Grab the package name
             $package = basename($cp['to']);
             // Set the dir to get the files from
             $modulesDir = $cp['to'] . '/modules/';
             // If we have the modules directory
             if (is_dir($modulesDir)) {
                 // Get the modules from inside the path
                 $dirs = glob($modulesDir . '*', GLOB_ONLYDIR);
                 if (!empty($dirs)) {
                     foreach ($dirs as $dirpath) {
                         // Get the module to list it in case it needs to be upgraded
                         $module = basename($dirpath);
                         // Get the metadata directory
                         $metadatadir = "{$dirpath}/metadata/";
                         // We only want to do this if there is a metadata dir
                         // and there isn't already a clients dir
                         if (is_dir($metadatadir) && !is_dir("{$dirpath}/clients")) {
                             // Get our upgrade files
                             $files = array_merge($files, $sidecarUpgrader->getUpgradeableFilesInPath($metadatadir, $module, 'wireless', 'base', $package, false));
                         }
                     }
                 }
             }
             // Upgrade them
             foreach ($files as $file) {
                 // Get the appropriate upgrade class name for this view type
                 $class = $sidecarUpgrader->getUpgraderClass($file['viewtype']);
                 if ($class) {
                     if (!class_exists($class, false)) {
                         $classfile = $class . '.php';
                         require_once "modules/UpgradeWizard/SidecarUpdate/{$classfile}";
                     }
                     $upgrader = new $class($sidecarUpgrader, $file);
                     // Let the upgrader do its thing
                     $upgrader->upgrade();
                 }
             }
         }
     }
 }