diff --git a/build.properties b/build.properties index 881940718..b79192da7 100644 --- a/build.properties +++ b/build.properties @@ -1,13 +1,39 @@ # Property files contain key=value pairs -# Geeklog version number +################################################################################# +# +# You should set: +# 1. version +# 2. previousVersion +# 3. previousVersionSHA +# +# before building +# +################################################################################## +# +## 1. Geeklog version number ## version=2.2.2 -# Git hash tag for the previous version of Geeklog. e.g., "936264c" for Geeklog 2.1.3 +## 2. Geeklog previous version number +previousVersion=2.2.1sr1 + +# 3. Git hash tag for the previous version of Geeklog. e.g., "936264c" for Geeklog 2.1.3 previousVersionSHA=79296e7 + # previousVersionSHA - Geeklog 2.2.1sr1 (79296e7) # previousVersionSHA - Geeklog 2.2.1 (860e7e6) # previousVersionSHA - Geeklog 2.2.0 (c7c2760) # Git hash tag for the current version of Geeklog. May be left empty. currentVersionSHA= + +## Directory / File permissions ## + +# dir with write permission +perm_dir_w=0777 + +# file with execute permission +perm_file_x=0755 + +# file with write permission +perm_file_w=0666 diff --git a/build.xml b/build.xml index 3eb60baf9..4607ca0c6 100644 --- a/build.xml +++ b/build.xml @@ -7,7 +7,8 @@ - + + @@ -22,9 +23,12 @@ - + + + + @@ -65,8 +69,8 @@ - - + + @@ -110,60 +114,60 @@ - - - - - - - - + + + + + + + + - - + + - - + + - - - - - - - - + + + + + + + + - - + + - - - - - + + + + + - + @@ -176,4 +180,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/system/build/lm/lm.php b/system/build/lm/lm.php index 1163c8055..52f9424bf 100644 --- a/system/build/lm/lm.php +++ b/system/build/lm/lm.php @@ -81,6 +81,7 @@ define('RECAPTCHA_NO_SUPPORT', 0); define('RECAPTCHA_SUPPORT_V2', 1); define('RECAPTCHA_SUPPORT_V2_INVISIBLE', 2); +define('RECAPTCHA_SUPPORT_V3', 4); // list of all variables accessed in the language file $_DB_mysqldump_path = '{$_DB_mysqldump_path}'; diff --git a/system/build/tasks/MyDiffTask.php b/system/build/tasks/MyDiffTask.php index 95fdd6b47..6cb2aeefd 100644 --- a/system/build/tasks/MyDiffTask.php +++ b/system/build/tasks/MyDiffTask.php @@ -1,6 +1,6 @@ startsWith = MyTaskCommon::$startsWith; + $this->excludes = MyTaskCommon::$excludes; + return true; } /** * Setter for the attribute "previousVersionSHA" * - * @param string $version + * @param string $version */ public function setPreviousVersionSHA($version) { @@ -58,7 +49,7 @@ public function setPreviousVersionSHA($version) /** * Setter for the attribute "currentVersionSHA" * - * @param string $version + * @param string $version */ public function setCurrentVersionSHA($version) { @@ -68,7 +59,7 @@ public function setCurrentVersionSHA($version) /** * Return if a given path should be included in diff result * - * @param string $path + * @param string $path * @return bool true if the $path should be included in diff result */ private function shouldInclude($path) @@ -79,7 +70,7 @@ private function shouldInclude($path) } } - foreach ($this->includes as $needle2) { + foreach ($this->excludes as $needle2) { if (strpos($path, $needle2) > 0) { return false; } @@ -95,20 +86,18 @@ public function main() { $currentDir = getcwd(); chdir(__DIR__ . '/../../../'); + exec('git config diff.renameLimit 999999'); - exec('git config diff.renameLimit 999999'); - - // Create 'changed-files' - exec(sprintf('git diff --name-only %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); + // Create the 'changed-files' file + exec(sprintf('git diff --name-only --diff-filter=ACMR %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); $changedFiles = array_filter($lines, [$this, 'shouldInclude']); @file_put_contents('./public_html/docs/changed-files', implode("\n", $changedFiles) . "\n"); - // Create 'removed-files' + // Create the 'removed-files' file unset($lines); - exec(sprintf('git diff --name-only --diff-filter=ACMRTUX %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); - $otherFiles = array_filter($lines, [$this, 'shouldInclude']); - $otherFiles = array_diff($changedFiles, $otherFiles); - @file_put_contents('./public_html/docs/removed-files', implode("\n", $otherFiles) . "\n"); + exec(sprintf('git diff --name-only --diff-filter=R %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); + $removedFiles = array_filter($lines, [$this, 'shouldInclude']); + @file_put_contents('./public_html/docs/removed-files', implode("\n", $removedFiles) . "\n"); exec('git config --unset diff.renameLimit'); diff --git a/system/build/tasks/MyRemoveUnchangedFilesTask.php b/system/build/tasks/MyRemoveUnchangedFilesTask.php new file mode 100644 index 000000000..5c8903705 --- /dev/null +++ b/system/build/tasks/MyRemoveUnchangedFilesTask.php @@ -0,0 +1,159 @@ +startsWith = MyTaskCommon::$startsWith; + $this->excludes = MyTaskCommon::$excludes; + + return true; + } + + /** + * Setter for the attribute "previousVersionSHA" + * + * @param string $version + */ + public function setPreviousVersionSHA($version) + { + $this->previousVersionSHA = $version; + } + + /** + * Setter for the attribute "currentVersionSHA" + * + * @param string $version + */ + public function setCurrentVersionSHA($version) + { + $this->currentVersionSHA = $version; + } + + /** + * Setter for the attribute "dstDir" + * + * @param string $dir + */ + public function setDstDir($dir) + { + $this->dstDir = str_replace('/\\', '/', $dir) . '/'; + } + + /** + * Return if a given path should be included in diff result + * + * @param string $path + * @return bool true if the $path should be included in diff result + */ + private function shouldInclude($path) + { + foreach ($this->startsWith as $needle) { + if (strpos($path, $needle) === 0) { + return false; + } + } + + foreach ($this->excludes as $needle2) { + if (strpos($path, $needle2) > 0) { + return false; + } + } + + return true; + } + + /** + * Remove files to exclude from the upgrade package + * + * @param string $dir current directory + */ + private function removeUnnecessaryFiles($dir) + { + foreach (scandir($dir) as $item) { + if (($item === '.') || ($item === '..')) { + continue; + } + + $path = $dir . $item; + + if (is_dir($path)) { + $this->removeUnnecessaryFiles($path . '/'); + } else { + $relativePath = str_ireplace($this->dstDir, '', $path); + + if (!in_array($relativePath, $this->filesToInclude) || !$this->shouldInclude($relativePath)) { + @unlink($path); + } + } + } + + // Remove an empty directory + if (count(scandir($dir)) === 2) { + @rmdir($dir); + } + } + + /** + * Create an upgrade distribution tarball + */ + public function main() + { + $currentDir = getcwd(); + chdir(__DIR__ . '/../../../'); + exec('git config diff.renameLimit 999999'); + + exec(sprintf('git diff --name-only --diff-filter=ACMR %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); + $this->filesToInclude = array_filter($lines, [$this, 'shouldInclude']); + $this->removeUnnecessaryFiles($this->dstDir); + + // Create the 'removed-files' file + unset($lines); + exec(sprintf('git diff --name-only --diff-filter=R %s %s', $this->previousVersionSHA, $this->currentVersionSHA), $lines); + $removedFiles = array_filter($lines, [$this, 'shouldInclude']); + @file_put_contents('./public_html/docs/removed-files', implode("\n", $removedFiles) . "\n"); + + exec('git config --unset diff.renameLimit'); + + if ($currentDir !== false) { + chdir($currentDir); + } + + } +} diff --git a/system/build/tasks/MyTaskCommon.php b/system/build/tasks/MyTaskCommon.php new file mode 100644 index 000000000..dbae11cfe --- /dev/null +++ b/system/build/tasks/MyTaskCommon.php @@ -0,0 +1,27 @@ +