Changeset 119844 in spip-zone


Ignore:
Timestamp:
Jan 20, 2020, 4:38:49 AM (5 weeks ago)
Author:
Cerdic
Message:

une abstraction git et une abstraction svn pour les fonctions de bas niveau dont on a besoin pour chaque methode

Location:
_plugins_/trad-lang/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/trad-lang/trunk

    • Property subgit:lock:88ad23850774e9762fd2b0b62c102fa1cc68005f deleted
    • Property subgit:lock:9ec9c5e09acda51ca50ee5b1ca8ae4ffc4c44f25 set to 2020-01-20T09:05:37.496
  • _plugins_/trad-lang/trunk/inc/salvatore_ecriveur.php

    r119840 r119844  
    3434include_spip('inc/lang_liste');
    3535include_spip('inc/session');
     36
     37include_spip('inc/salvatore_svn');
     38include_spip('inc/salvatore_git');
    3639
    3740
     
    311314                $nb_to_commit = count($commit_infos);
    312315                if ($message_commit) {
    313                         $commit_infos['message'] = $message_commit;
     316                        $commit_infos['.message'] = $message_commit;
    314317                }
    315318                file_put_contents($dir_module . '/' . $module . '.commit.json', json_encode($commit_infos));
     
    395398                $file_path_relative = $source['dir'] . DIRECTORY_SEPARATOR . $file_path_relative;
    396399        }
    397         $file_path = $dir_depots . $source['dir_checkout'] . DIRECTORY_SEPARATOR . $file_path_relative;
    398 
    399         $lastmodified = 0;
    400         switch ($source['methode']) {
    401                 case 'git':
    402                         $d = getcwd();
    403                         chdir($dir_depots . $source['dir_checkout']);
    404                         $lastmodified = exec("git log -1 -c --pretty=tformat:'%ct' $file_path_relative | head -1");
    405                         $lastmodified = intval(trim($lastmodified));
    406                         chdir($d);
    407                         break;
    408                 case 'svn':
    409                         $lastmodified = exec('env LC_MESSAGES=en_US.UTF-8 svn info ' . $file_path . "| awk '/^Last Changed Date/ { print $4 \" \" $5 }'");
    410                         $lastmodified = strtotime($lastmodified);
    411                         break;
    412         }
    413 
    414         return $lastmodified;
     400
     401        $salvatore_lastmodified_file = "salvatore_" . $source['methode'] . "_lastmodified_file";
     402        return $salvatore_lastmodified_file($dir_depots . $source['dir_checkout'], $file_path_relative);
    415403}
    416404
     
    429417        }
    430418        $files_list = [$pre . $module . '_*', $pre . $module . '.xml'];
    431         $files_list = implode(' ', $files_list);
    432 
    433         $d = getcwd();
    434         chdir($dir_depots . $source['dir_checkout']);
    435         $output = array();
    436         switch ($source['methode']) {
    437                 case 'git':
    438                         exec("git status --short $files_list 2>&1", $output);
    439                         break;
    440                 case 'svn':
    441                         exec("svn status $files_list 2>&1", $output);
    442                         break;
    443         }
    444         chdir($d);
    445         return implode("\n", $output);
     419
     420        $salvatore_status_file = "salvatore_" . $source['methode'] . "_status_file";
     421        return $salvatore_status_file($dir_depots . $source['dir_checkout'], $files_list);
    446422}
    447423
Note: See TracChangeset for help on using the changeset viewer.