Пример #1
0
 public static function core_list_changed_files()
 {
     $upgrader = new UpgraderCore();
     $files = $upgrader->getChangedFilesList();
     // as in AdminInformationController.php
     $excludeRegexp = '(install(-dev|-new)?|themes|tools|cache|docs|download|img|localization|log|mails|translations|upload|modules|override/(:?.*)index.php$)';
     $modFiles = array();
     $table = new Cli\Table();
     $table->setHeaders(array('Part', 'file'));
     if ($files) {
         foreach ($files as $changedFileKey => $changedFileVal) {
             if (!isset($modFiles[$changedFileKey])) {
                 $modFiles[$changedFileKey] = array();
             }
             foreach ($changedFileVal as $modifiedFiles) {
                 if (preg_match('#^' . $excludeRegexp . '#', $modifiedFiles)) {
                     continue;
                 }
                 array_push($modFiles[$changedFileKey], $modifiedFiles);
             }
         }
         foreach ($modFiles as $curModFiles => $values) {
             if (empty($values)) {
                 continue;
             }
             foreach ($values as $value) {
                 //echo "  $value\n";
                 $table->addRow(array($curModFiles, $value));
             }
         }
     }
     if ($table->countRows() > 0) {
         $table->display();
     } else {
         echo "No modified files to show\n";
     }
     return;
 }