@@ -13,5 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | $message = shell_exec('git show -s --format=%B ' . $hash . ' | tail -n 1'); |
| 15 | 15 | $result = stripos($message, 'Signed-off by:'); |
| 16 | -if ($result === false) |
|
| 17 | - die('Error: Signed-off by not found in commit message'); |
|
| 18 | 16 | \ No newline at end of file |
| 17 | +if ($result === false) { |
|
| 18 | + die('Error: Signed-off by not found in commit message'); |
|
| 19 | +} |
|
@@ -17,25 +17,29 @@ discard block |
||
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | 19 | // No file? Thats bad. |
| 20 | -if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) |
|
| 20 | +if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) { |
|
| 21 | 21 | die('Error: No File specified' . "\n"); |
| 22 | +} |
|
| 22 | 23 | |
| 23 | 24 | // The file has to exist. |
| 24 | 25 | $currentFile = $_SERVER['argv'][1]; |
| 25 | -if (!file_exists($currentFile)) |
|
| 26 | +if (!file_exists($currentFile)) { |
|
| 26 | 27 | die('Error: File does not exist' . "\n"); |
| 28 | +} |
|
| 27 | 29 | |
| 28 | 30 | // Is this ignored? |
| 29 | -foreach ($ignoreFiles as $if) |
|
| 31 | +foreach ($ignoreFiles as $if) { |
|
| 30 | 32 | if (preg_match('~' . $if . '~i', $currentFile)) |
| 31 | 33 | die; |
| 34 | +} |
|
| 32 | 35 | |
| 33 | 36 | // Lets get the main index.php for $forum_version and $software_year. |
| 34 | 37 | $upgradeFile = fopen('./other/upgrade.php', 'r'); |
| 35 | 38 | $upgradeContents = fread($upgradeFile, 500); |
| 36 | 39 | |
| 37 | -if (!preg_match('~define\(\'SMF_LANG_VERSION\', \'([^\']+)\'\);~i', $upgradeContents, $versionResults)) |
|
| 40 | +if (!preg_match('~define\(\'SMF_LANG_VERSION\', \'([^\']+)\'\);~i', $upgradeContents, $versionResults)) { |
|
| 38 | 41 | die('Error: Could not locate SMF_LANG_VERSION' . "\n"); |
| 42 | +} |
|
| 39 | 43 | $currentVersion = $versionResults[1]; |
| 40 | 44 | |
| 41 | 45 | $file = fopen($currentFile, 'r'); |
@@ -44,15 +48,18 @@ discard block |
||
| 44 | 48 | |
| 45 | 49 | // Just see if the basic match is there. |
| 46 | 50 | $match = '// Version: ' . $currentVersion; |
| 47 | -if (!preg_match('~' . $match . '~i', $contents)) |
|
| 51 | +if (!preg_match('~' . $match . '~i', $contents)) { |
|
| 48 | 52 | die('Error: The version is missing or incorrect in ' . $currentFile . "\n"); |
| 53 | +} |
|
| 49 | 54 | |
| 50 | 55 | // Get the file prefix. |
| 51 | 56 | preg_match('~([A-Za-z]+)\.english\.php~i', $currentFile, $fileMatch); |
| 52 | -if (empty($fileMatch)) |
|
| 57 | +if (empty($fileMatch)) { |
|
| 53 | 58 | die('Error: Could not locate locate the file name in ' . $currentFile . "\n"); |
| 59 | +} |
|
| 54 | 60 | |
| 55 | 61 | // Now match that prefix in a more strict mode. |
| 56 | 62 | $match = '// Version: ' . $currentVersion . '; ' . $fileMatch[1]; |
| 57 | -if (!preg_match('~' . $match . '~i', $contents)) |
|
| 58 | - die('Error: The version with file name is missing or incorrect in ' . $currentFile . "\n"); |
|
| 59 | 63 | \ No newline at end of file |
| 64 | +if (!preg_match('~' . $match . '~i', $contents)) { |
|
| 65 | + die('Error: The version with file name is missing or incorrect in ' . $currentFile . "\n"); |
|
| 66 | +} |
|
@@ -47,29 +47,34 @@ discard block |
||
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | 49 | // No file? Thats bad. |
| 50 | -if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) |
|
| 50 | +if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) { |
|
| 51 | 51 | die('Error: No File specified' . "\n"); |
| 52 | +} |
|
| 52 | 53 | |
| 53 | 54 | // The file has to exist. |
| 54 | 55 | $currentFile = $_SERVER['argv'][1]; |
| 55 | -if (!file_exists($currentFile)) |
|
| 56 | +if (!file_exists($currentFile)) { |
|
| 56 | 57 | die('Error: File does not exist' . "\n"); |
| 58 | +} |
|
| 57 | 59 | |
| 58 | 60 | // Is this ignored? |
| 59 | -foreach ($ignoreFiles as $if) |
|
| 61 | +foreach ($ignoreFiles as $if) { |
|
| 60 | 62 | if (preg_match('~' . $if . '~i', $currentFile)) |
| 61 | 63 | die; |
| 64 | +} |
|
| 62 | 65 | |
| 63 | 66 | // Lets get the main index.php for $forum_version and $software_year. |
| 64 | 67 | $indexFile = fopen('./index.php', 'r'); |
| 65 | 68 | $indexContents = fread($indexFile, 850); |
| 66 | 69 | |
| 67 | -if (!preg_match('~\$forum_version = \'SMF ([^\']+)\';~i', $indexContents, $versionResults)) |
|
| 70 | +if (!preg_match('~\$forum_version = \'SMF ([^\']+)\';~i', $indexContents, $versionResults)) { |
|
| 68 | 71 | die('Error: Could not locate $forum_version' . "\n"); |
| 72 | +} |
|
| 69 | 73 | $currentVersion = $versionResults[1]; |
| 70 | 74 | |
| 71 | -if (!preg_match('~\$software_year = \'(\d{4})\';~i', $indexContents, $yearResults)) |
|
| 75 | +if (!preg_match('~\$software_year = \'(\d{4})\';~i', $indexContents, $yearResults)) { |
|
| 72 | 76 | die('Error: Could not locate $software_year' . "\n"); |
| 77 | +} |
|
| 73 | 78 | $currentSoftwareYear = (int) $yearResults[1]; |
| 74 | 79 | |
| 75 | 80 | $file = fopen($currentFile, 'r'); |
@@ -90,17 +95,20 @@ discard block |
||
| 90 | 95 | ); |
| 91 | 96 | |
| 92 | 97 | // Just see if the license is there. |
| 93 | -if (!preg_match('~' . implode('', $match) . '~i', $contents)) |
|
| 98 | +if (!preg_match('~' . implode('', $match) . '~i', $contents)) { |
|
| 94 | 99 | die('Error: License File is invalid or not found in ' . $currentFile . "\n"); |
| 100 | +} |
|
| 95 | 101 | |
| 96 | 102 | // Check the year is correct. |
| 97 | 103 | $yearMatch = $match; |
| 98 | 104 | $yearMatch[4] = ' \* @copyright ' . $currentSoftwareYear . ' Simple Machines and individual contributors' . '[\r]?\n'; |
| 99 | -if (!preg_match('~' . implode('', $yearMatch) . '~i', $contents)) |
|
| 105 | +if (!preg_match('~' . implode('', $yearMatch) . '~i', $contents)) { |
|
| 100 | 106 | die('Error: The software year is incorrect in ' . $currentFile . "\n"); |
| 107 | +} |
|
| 101 | 108 | |
| 102 | 109 | // Check the version is correct. |
| 103 | 110 | $versionMatch = $match; |
| 104 | 111 | $versionMatch[7] = ' \* @version ' . $currentVersion . '[\r]?\n'; |
| 105 | -if (!preg_match('~' . implode('', $versionMatch) . '~i', $contents)) |
|
| 106 | - die('Error: The version is incorrect in ' . $currentFile . "\n"); |
|
| 107 | 112 | \ No newline at end of file |
| 113 | +if (!preg_match('~' . implode('', $versionMatch) . '~i', $contents)) { |
|
| 114 | + die('Error: The version is incorrect in ' . $currentFile . "\n"); |
|
| 115 | +} |
|