Actions
Bug #25378
closedRemove SVN auto properties $Id$
Start date:
2011-03-23
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
As we moved to GIT, SVN auto properties are now completely useless and are not updated anymore. We should get rid of them.
(issue imported from #M18016)
Updated by Xavier Perseguers over 13 years ago
This command should basically do the job:
$ for f in $(grep -isr "\$Id" * | cut -d":" -f1); do awk '{ if (!/\$Id/) print }' $f > $f.new; mv $f.new $f; done
Updated by Xavier Perseguers over 13 years ago
Updated by Xavier Perseguers over 13 years ago
This code was finally used before some manual tweaking:
function main() {
$files = array();
exec('grep -isr "\$Id" * | cut -d":" -f1', $files);
foreach ($files as $file) {
$ext = substr($file, strrpos($file, '.') + 1);
if (!in_array($ext, array('txt', 'php', 'sh', 'js', 'sql', 'inc', 'phpsh', 'html', 'htm', 'css', 'xml'))) {
continue;
}
if ($file === basename(FILE)) {
continue;
}
remove_id($file);
}
}
function remove_id($file) {
$isPHP = substr($file, -4) === '.php';
$content = file_get_contents($file);
$lines = explode("\n", $content);
$newLines = array();
$previousLine = '';
foreach ($lines as $line) {
if (preg_match('/\$Id/', $line)) {
if (trim($previousLine) === '*' || trim($previousLine) === '#') {
array_pop($newLines);
}
continue;
}
$newLines[] = $line;
$previousLine = $line;
}
$content = implode("\n", $newLines);
$fd = fopen($file, 'wb');
$res = fwrite($fd, $content);
fclose($fd);
}
main();
?>
Updated by Xavier Perseguers over 12 years ago
- Status changed from Resolved to Closed
Updated by Ernesto Baschny over 11 years ago
- Target version deleted (
4.6.0-beta1)
Actions