-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[+] Agregué la importación de categoríás y post de wordpress a joomla
- Loading branch information
1 parent
6585476
commit 3c9db1b
Showing
20 changed files
with
1,057 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Workflow que genera un release en github con el zip del componente usando softprops/action-gh-release | ||
# 1. Se ejecuta cuando se crea un tag en la rama master | ||
# 2. ejecuta `php build/build-component.php` para generar el zip | ||
# 3. Crea un release en github con el zip generado en dist/plg_system_wp2joomla.zip | ||
# 4. Crea un tag en github con el nombre del tag creado en master | ||
|
||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build plugin | ||
run: php build/build_plugin.php | ||
- name: Build CHANGELOG.md | ||
run: php build/build_changelog.php --from=$(git tag --sort=version:refname | tail -n2 | sort -r | tail -n1) --dest=dist/CHANGELOG.md | ||
- name: Get release name | ||
id: getReleaseName | ||
run: echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/tags\//} | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: dist/plg_system_wp2joomla.zip | ||
name: v${{ steps.getReleaseName.outputs.RELEASE_NAME }} | ||
tag_name: ${{ steps.getReleaseName.outputs.RELEASE_NAME }} | ||
body_path: dist/CHANGELOG.md | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
|
||
const PHP_TAB = "\t"; | ||
|
||
function usage($command) | ||
{ | ||
echo PHP_EOL; | ||
echo 'Usage: php ' . $command . ' [options]' . PHP_EOL; | ||
echo PHP_TAB . '[options]:' . PHP_EOL; | ||
echo PHP_TAB . PHP_TAB . '--from <from>:' . PHP_TAB . 'El tag de la versión desde la cual se van a obtener los commits (ex: `tags/3.8.6`, `4.0-dev`)' . PHP_EOL; | ||
echo PHP_TAB . PHP_TAB . '--version <version>:' . PHP_TAB . 'La versión para agregar en el changelog' . PHP_EOL; | ||
echo PHP_TAB . PHP_TAB . '--help:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output' . PHP_EOL . PHP_EOL; | ||
echo PHP_TAB . PHP_TAB . 'Ejemplo: php build_changelog.php --from=1.12.0 --version=1.13.0' . PHP_EOL; | ||
echo PHP_EOL; | ||
} | ||
|
||
if (version_compare(PHP_VERSION, '5.4', '<')) | ||
{ | ||
echo "The build script requires PHP 5.4.\n"; | ||
|
||
exit(1); | ||
} | ||
|
||
$time = time(); | ||
|
||
// Set path to git binary (e.g., /usr/local/git/bin/git or /usr/bin/git) | ||
ob_start(); | ||
passthru('which git', $systemGit); | ||
$systemGit = trim(ob_get_clean()); | ||
|
||
if (empty($systemGit)) { | ||
ob_start(); | ||
passthru('where git', $systemGit); | ||
$systemGit = trim(ob_get_clean()); | ||
} | ||
|
||
if (empty($systemGit)) | ||
{ | ||
die('Install Git'); | ||
} | ||
|
||
// Make sure file and folder permissions are set correctly | ||
umask(022); | ||
|
||
// Shortcut the paths to the repository root and build folder | ||
$repo = dirname(__DIR__); | ||
$here = __DIR__; | ||
|
||
// Set paths for the build packages | ||
$tmp = $here . '/tmp'; | ||
$fullpath = $tmp . '/' . $time; | ||
|
||
// Parse input options | ||
$options = getopt('', array('help', 'from::', 'version::', 'dest::')); | ||
|
||
$from = $options['from']; | ||
$version = isset($options['version']) ? $options['version'] : ''; | ||
$dest = isset($options['dest']) ? $options['dest'] : $repo . '/CHANGELOG.md'; | ||
$showHelp = isset($options['help']); | ||
|
||
if ($showHelp) | ||
{ | ||
usage($argv[0]); | ||
die; | ||
} | ||
|
||
if (empty($from)){ | ||
usage($argv[0]); | ||
die; | ||
} | ||
|
||
chdir($repo); | ||
ob_start(); | ||
system('"'.$systemGit . '" log --pretty=oneline HEAD...' . $from, $commits); | ||
$commits = explode("\n", trim(ob_get_clean())); | ||
|
||
/* | ||
echo "Start build for remote $remote.\n"; | ||
echo "Delete old release folder.\n"; | ||
system('rm -rf ' . $tmp); | ||
mkdir($tmp); | ||
mkdir($fullpath); | ||
*/ | ||
$data = '# Versión'.(!empty($version) ? ' ' . $version : '').' - '.date('d/m/Y'); | ||
$data .= "\n\n"; | ||
|
||
foreach ($commits as &$commit) { | ||
|
||
$parts = explode(' ', $commit); | ||
unset($parts[0]); | ||
$commit = implode(' ', array_values($parts)); | ||
|
||
if (strpos($commit, '[*]') === false && | ||
strpos($commit, '[+]') === false && | ||
strpos($commit, '[-]') === false && | ||
strpos($commit, '[x]') === false) | ||
{ | ||
continue; | ||
} | ||
|
||
$data .= '- ' . $commit."\n"; | ||
} | ||
|
||
$filename = $dest; | ||
|
||
if (file_exists($filename)) { | ||
$content = file_get_contents($filename); | ||
$data .= "\n".$content; | ||
} | ||
|
||
file_put_contents($filename, $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* @package AlejoASotelo | ||
* @subpackage com_sabullvial | ||
* @author Alejo A. Sotelo | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
* @link alejosotelo.com.ar | ||
*/ | ||
|
||
// Directorio raíz del proyecto | ||
$root_dir = dirname(__DIR__); | ||
|
||
$component_name = 'plg_system_wp2joomla'; | ||
|
||
// Directorio de origen | ||
$source_dir = $root_dir . '/plg_system_wp2joomla'; | ||
|
||
// Directorio de destino | ||
$dest_dir = $root_dir . '/dist/' . $component_name; | ||
|
||
// Archivo ZIP de destino | ||
$zip_file = $component_name . '.zip'; | ||
|
||
// Lista de archivos y carpetas a excluir | ||
$exclude = array(".git", ".gitignore", "node_modules", 'php-hot-reloader', 'phrwatcher.php', 'vendor', '.php-cs-fixer.cache', '.php-cs-fixer.dist.php'); | ||
|
||
if (file_exists($dest_dir)) { | ||
shell_exec("rm -rf $dest_dir"); | ||
shell_exec('rm -rf '.dirname($dest_dir) . '/' . $zip_file); | ||
} | ||
|
||
// Crear el directorio de destino si no existe | ||
shell_exec("mkdir -p $dest_dir"); | ||
|
||
// Construir el comando rsync con las opciones necesarias | ||
$options = "-a --delete"; | ||
foreach ($exclude as $ex) { | ||
$options .= " --exclude=" . $ex; | ||
} | ||
$command = "rsync $options $source_dir/ $dest_dir"; | ||
|
||
shell_exec($command); | ||
|
||
if (file_exists($source_dir . '/composer.json')) { | ||
shell_exec('composer install --no-dev --optimize-autoloader --no-interaction --working-dir=' . $dest_dir); | ||
} | ||
|
||
// Cambiar al directorio de destino | ||
chdir(dirname($dest_dir)); | ||
|
||
// Comprimir el directorio de destino en un archivo ZIP | ||
$command = "zip -rq $zip_file $component_name"; | ||
$result = shell_exec($command); | ||
|
||
// Ejecutar el comando y mostrar el resultado | ||
echo $result; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE `#__wp2joomla_categories` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`id_joomla` INT(11) NOT NULL, | ||
`id_adapter` INT(11) NOT NULL, | ||
`title` VARCHAR(255) NOT NULL, | ||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE `#__wp2joomla_articles` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`id_joomla` INT(11) NOT NULL, | ||
`id_adapter` INT(11) NOT NULL, | ||
`title` VARCHAR(255) NOT NULL, | ||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE IF EXISTS `#__wp2joomla_categories`; | ||
DROP TABLE IF EXISTS `#__wp2joomla_articles`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
DROP TABLE IF EXISTS `#__wp2joomla_categories`; | ||
|
||
CREATE TABLE `#__wp2joomla_categories` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`id_joomla` INT(11) NOT NULL, | ||
`id_wordpress` INT(11) NOT NULL, | ||
`name` VARCHAR(255) NOT NULL, | ||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; | ||
|
||
DROP TABLE IF EXISTS `#__wp2joomla_articles`; | ||
|
||
CREATE TABLE `#__wp2joomla_articles` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT, | ||
`id_joomla` INT(11) NOT NULL, | ||
`id_wordpress` INT(11) NOT NULL, | ||
`name` VARCHAR(255) NOT NULL, | ||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE `#__wp2joomla_categories` CHANGE `name` `title` VARCHAR(255) NOT NULL; | ||
ALTER TABLE `#__wp2joomla_articles` CHANGE `name` `title` VARCHAR(255) NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE `#__wp2joomla_categories` CHANGE `id_wordpress` `id_adapter` INT(11) NOT NULL; | ||
ALTER TABLE `#__wp2joomla_articles` CHANGE `id_wordpress` `id_adapter` INT(11) NOT NULL; |
Oops, something went wrong.