29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-08-06 11:10:30 +00:00

Add a script to get a list of deleted files between two references. This script generates an output that is suitable for pasting directly into the deleted files listing. Rebuild the 3.8.0 listing based on this script.

This commit is contained in:
Michael Babker 2017-09-04 16:36:00 -05:00
parent 80e5d4ff91
commit d9f279e550
3 changed files with 162 additions and 17 deletions

View File

@ -1597,30 +1597,30 @@ class JoomlaInstallerScript
'/administrator/components/com_admin/postinstall/phpversion.php',
'/components/com_content/layouts/field/prepare/modal_article.php',
// Joomla 3.8.0
'/administrator/components/com_content/models/fields/votelist.php',
'/administrator/modules/mod_menu/preset/disabled.php',
'/administrator/modules/mod_menu/preset/enabled.php',
'/libraries/cms/application/administrator.php',
'/libraries/cms/application/cms.php',
'/libraries/cms/application/helper.php',
'/libraries/cms/application/site.php',
'/libraries/cms/authentication/helper.php',
'/libraries/cms/captcha/captcha.php',
'/libraries/cms/component/exception/missing.php',
'/libraries/cms/component/helper.php',
'/libraries/cms/component/record.php',
'/libraries/cms/component/exception/missing.php',
'/libraries/cms/component/router/base.php',
'/libraries/cms/component/router/interface.php',
'/libraries/cms/component/router/legacy.php',
'/libraries/cms/component/router/rules/interface.php',
'/libraries/cms/component/router/rules/menu.php',
'/libraries/cms/component/router/rules/nomenu.php',
'/libraries/cms/component/router/rules/standard.php',
'/libraries/cms/component/router/base.php',
'/libraries/cms/component/router/interface.php',
'/libraries/cms/component/router/legacy.php',
'/libraries/cms/component/router/view.php',
'/libraries/cms/component/router/viewconfiguration.php',
'/libraries/cms/editor/editor.php',
'/libraries/cms/error/page.php',
'/libraries/cms/extension/helper.php',
'/libraries/cms/filter/input.php',
'/libraries/cms/filter/output.php',
'/libraries/cms/filter/wrapper/output.php',
'/libraries/cms/form/field/author.php',
'/libraries/cms/form/field/captcha.php',
'/libraries/cms/form/field/chromestyle.php',
@ -1629,7 +1629,7 @@ class JoomlaInstallerScript
'/libraries/cms/form/field/contenttype.php',
'/libraries/cms/form/field/editor.php',
'/libraries/cms/form/field/frontend_language.php',
'/libraries/cms/form/field/headertab.php',
'/libraries/cms/form/field/headertag.php',
'/libraries/cms/form/field/helpsite.php',
'/libraries/cms/form/field/lastvisitdaterange.php',
'/libraries/cms/form/field/limitbox.php',
@ -1645,8 +1645,8 @@ class JoomlaInstallerScript
'/libraries/cms/form/field/status.php',
'/libraries/cms/form/field/tag.php',
'/libraries/cms/form/field/templatestyle.php',
'/libraries/cms/form/field/useractive.php',
'/libraries/cms/form/field/user.php',
'/libraries/cms/form/field/useractive.php',
'/libraries/cms/form/field/usergrouplist.php',
'/libraries/cms/form/field/userstate.php',
'/libraries/cms/form/rule/captcha.php',
@ -1662,11 +1662,6 @@ class JoomlaInstallerScript
'/libraries/cms/helper/usergroups.php',
'/libraries/cms/html/html.php',
'/libraries/cms/installer/adapter.php',
'/libraries/cms/installer/extension.php',
'/libraries/cms/installer/helper.php',
'/libraries/cms/installer/installer.php',
'/libraries/cms/installer/manifest.php',
'/libraries/cms/installer/script.php',
'/libraries/cms/installer/adapter/component.php',
'/libraries/cms/installer/adapter/file.php',
'/libraries/cms/installer/adapter/language.php',
@ -1675,8 +1670,14 @@ class JoomlaInstallerScript
'/libraries/cms/installer/adapter/package.php',
'/libraries/cms/installer/adapter/plugin.php',
'/libraries/cms/installer/adapter/template.php',
'/libraries/cms/installer/extension.php',
'/libraries/cms/installer/helper.php',
'/libraries/cms/installer/installer.php',
'/libraries/cms/installer/manifest.php',
'/libraries/cms/installer/manifest/library.php',
'/libraries/cms/installer/manifest/package.php',
'/libraries/cms/installer/script.php',
'/libraries/cms/language/associations.php',
'/libraries/cms/language/multilang.php',
'/libraries/cms/layout/base.php',
'/libraries/cms/layout/file.php',
@ -1721,6 +1722,7 @@ class JoomlaInstallerScript
'/libraries/cms/ucm/base.php',
'/libraries/cms/ucm/content.php',
'/libraries/cms/ucm/type.php',
'/libraries/cms/ucm/ucm.php',
'/libraries/cms/version/version.php',
'/libraries/joomla/access/access.php',
'/libraries/joomla/access/exception/notallowed.php',
@ -1837,6 +1839,7 @@ class JoomlaInstallerScript
'/libraries/joomla/http/transport/socket.php',
'/libraries/joomla/http/transport/stream.php',
'/libraries/joomla/http/wrapper/factory.php',
'/libraries/joomla/image/filter.php',
'/libraries/joomla/image/filter/backgroundfill.php',
'/libraries/joomla/image/filter/brightness.php',
'/libraries/joomla/image/filter/contrast.php',
@ -1846,7 +1849,6 @@ class JoomlaInstallerScript
'/libraries/joomla/image/filter/negate.php',
'/libraries/joomla/image/filter/sketchy.php',
'/libraries/joomla/image/filter/smooth.php',
'/libraries/joomla/image/filter.php',
'/libraries/joomla/image/image.php',
'/libraries/joomla/input/cli.php',
'/libraries/joomla/input/cookie.php',
@ -1931,8 +1933,6 @@ class JoomlaInstallerScript
'/libraries/legacy/view/legacy.php',
'/libraries/legacy/web/client.php',
'/libraries/legacy/web/web.php',
'/administrator/modules/mod_menu/preset/enabled.php',
'/administrator/modules/mod_menu/preset/disabled.php',
);
// TODO There is an issue while deleting folders using the ftp mode

3
build/.gitignore vendored
View File

@ -7,3 +7,6 @@
# Ignore the folder the build script creates for packages
/tmp
/com_joomlaupdate-pkg
# Ignore the deleted file script output
/deleted_files.txt

View File

@ -0,0 +1,142 @@
<?php
/**
* This file is used to build the list of deleted files between two reference points.
*
* This script requires one parameter:
*
* --from - The git commit reference to use as the starting point for the comparison.
*
* This script has one additional optional parameter:
*
* --to - The git commit reference to use as the ending point for the comparison.
*
* The reference parameters may be any valid identifier (i.e. a branch, tag, or commit SHA)
*
* @package Joomla.Build
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Detect the native operating system type.
$os = strtoupper(substr(PHP_OS, 0, 3));
if ($os === 'WIN')
{
echo 'Sorry, this script is not supported on Windows.' . PHP_EOL;
exit(1);
}
/*
* Constants
*/
const PHP_TAB = "\t";
/*
* Globals
*/
global $currentDir;
$currentDir = getcwd();
global $changedFiles;
$changedFiles = array();
global $deletedFiles;
$deletedFiles = array();
global $gitBinary;
ob_start();
passthru('which git', $gitBinary);
$gitBinary = trim(ob_get_clean());
/*
* Functions
*/
function run_git_command($command)
{
global $currentDir;
chdir(dirname(__DIR__));
ob_start();
passthru($command);
$return = trim(ob_get_clean());
chdir($currentDir);
return $return;
}
function usage($command)
{
echo PHP_EOL;
echo 'Usage: php ' . $command . ' [options]' . PHP_EOL;
echo PHP_TAB . '--from <ref>:' . PHP_TAB . 'Starting commit reference (branch/tag)' . PHP_EOL;
echo PHP_TAB . '--to <ref>:' . PHP_TAB . 'Ending commit reference (branch/tag) [optional]' . PHP_EOL;
echo PHP_EOL;
}
/*
* This is where the magic happens
*/
$options = getopt('', array('from:', 'to::'));
// We need the from reference, otherwise we're doomed to fail
if (empty($options['from']))
{
echo PHP_EOL;
echo 'Missing starting commit reference' . PHP_EOL;
usage($argv[0]);
exit(1);
}
// Missing the to reference? No problem, grab the current HEAD
if (empty($options['to']))
{
$options['to'] = run_git_command("$gitBinary rev-parse HEAD");
}
// Parse the git diff to know what files have been added, removed, or renamed
$fileDiff = explode("\n", run_git_command("$gitBinary diff --name-status {$options['from']} {$options['to']}"));
$deletedFiles = array();
foreach ($fileDiff as $file)
{
$fileName = substr($file, 2);
// Act on the file based on the action
switch (substr($file, 0, 1))
{
// This is a new case with git 2.9 to handle renamed files
case 'R':
// Explode the file on the tab character; key 0 is the action (rename), key 1 is the old filename, and key 2 is the new filename
$renamedFileData = explode("\t", $file);
// And flag the old file as deleted
$deletedFiles[] = "'/{$renamedFileData[1]}',";
break;
case 'D':
$deletedFiles[] = "'/$fileName',";
break;
default:
// Ignore file additions and modifications
break;
}
}
asort($deletedFiles);
// Write the deleted files list to a file for later reference
file_put_contents(__DIR__ . '/deleted_files.txt', implode("\n", $deletedFiles));