Exemplo n.º 1
0
 public static function gibPluginDateien($input, &$fileList, &$fileListAddress, &$componentFiles)
 {
     $mainPath = dirname(__FILE__) . '/../..';
     if (isset($input['files'])) {
         $files = $input['files'];
         if (!is_array($files)) {
             $files = array($files);
         }
         foreach ($files as $file) {
             if (isset($file['path'])) {
                 if (is_dir($mainPath . '/' . $file['path'])) {
                     $found = Installation::read_all_files($mainPath . '/' . $file['path']);
                     foreach ($found['files'] as $temp) {
                         $fileList[] = $temp;
                         $fileListAddress[] = substr($temp, strlen($mainPath) + 1);
                     }
                 } else {
                     $fileList[] = $mainPath . '/' . $file['path'];
                     $fileListAddress[] = $file['path'];
                 }
             }
         }
     }
     if (isset($input['components'])) {
         $files = $input['components'];
         if (!is_array($files)) {
             $files = array($files);
         }
         foreach ($files as $file) {
             if (isset($file['conf'])) {
                 if (!file_exists($mainPath . '/' . $file['conf']) || !is_readable($mainPath . '/' . $file['conf'])) {
                     continue;
                 }
                 $componentFiles[] = $mainPath . '/' . $file['conf'];
                 $definition = file_get_contents($mainPath . '/' . $file['conf']);
                 $definition = json_decode($definition, true);
                 $comPath = dirname($mainPath . '/' . $file['conf']);
                 $fileList[] = $mainPath . '/' . $file['conf'];
                 $fileListAddress[] = $file['conf'];
                 if (isset($definition['files'])) {
                     if (!is_array($definition['files'])) {
                         $definition['files'] = array($definition['files']);
                     }
                     foreach ($definition['files'] as $paths) {
                         if (!isset($paths['path'])) {
                             continue;
                         }
                         if (is_dir($comPath . '/' . $paths['path'])) {
                             $found = Installation::read_all_files($comPath . '/' . $paths['path']);
                             foreach ($found['files'] as $temp) {
                                 $fileList[] = $temp;
                                 $fileListAddress[] = substr($temp, strlen($mainPath) + 1);
                             }
                         } else {
                             $fileList[] = $comPath . '/' . $paths['path'];
                             $fileListAddress[] = dirname($file['conf']) . '/' . $paths['path'];
                         }
                     }
                 }
             }
         }
     }
 }