diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/extensions/ImportarPerfil |
first commit
Diffstat (limited to 'www/wiki/extensions/ImportarPerfil')
5 files changed, 85 insertions, 0 deletions
diff --git a/www/wiki/extensions/ImportarPerfil/ImportarPerfil.class.php b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.class.php new file mode 100644 index 00000000..4141e047 --- /dev/null +++ b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.class.php @@ -0,0 +1,17 @@ +<?php + +class ImportarPerfilHooks { + public static function afterAddNewAccount( $user, $byEmail ) { + // Do nothing if account creation was by e-mail + if ( $byEmail ) { + return true; + } + $username = $user->mName; + $email = $user->mEmail; + error_log("############### Se creo una cuenta, intento importar datos del perfil de $username de Elgg si existe"); + $importar = exec("php /srv/reevo-2020/bin/wiki/ImportarPerfil/ImportarPerfil.php -n true -u $username -e $email"); + error_log("Devolvio: $importar"); + + // return self::addRedirect( 'addnewaccount' ); + } +} diff --git a/www/wiki/extensions/ImportarPerfil/ImportarPerfil.i18n.php b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.i18n.php new file mode 100644 index 00000000..d3e32810 --- /dev/null +++ b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.i18n.php @@ -0,0 +1,17 @@ +<?php +/** + * Internationalisation file for the Redirect extension. + * + * @file + * @ingroup Extensions + */ + +$messages = array(); + +/** English + * @author Siebrand Mazeland + */ +$messages['es'] = array( + 'importarperfil-desc' => 'Se han importado los datos del [https://red.reevo.org/profile/$username perfil del usuario $username de la versión anterior de REEVO] a tu [[Usuario:$username|página de usuario]]"; +', +); diff --git a/www/wiki/extensions/ImportarPerfil/ImportarPerfil.php b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.php new file mode 100644 index 00000000..63383eac --- /dev/null +++ b/www/wiki/extensions/ImportarPerfil/ImportarPerfil.php @@ -0,0 +1,20 @@ +<?php +if ( !defined( 'MEDIAWIKI' ) ) die(); + + +$wgExtensionCredits['other'][] = array( + 'path' => __FILE__, + 'name' => 'ImportarPerfil', + 'version' => '1.0', + 'author' => array( 'Franco Iacomella' ) +); +$dtgIP = dirname( __FILE__ ); + +$dir = dirname( __FILE__ ) . '/'; +$wgAutoloadClasses['ImportarPerfilHooks'] = $dir . 'ImportarPerfil.class.php'; + +$wgHooks['LocalUserCreated'][] = 'ImportarPerfilHooks::afterAddNewAccount'; + +$wgSpecialPages['ImportarPerfil'] = 'DTImportarPerfil'; +$wgAutoloadClasses['DTImportarPerfil'] = $dtgIP . '/specials/ImportarPerfil.php'; +$wgMessagesDirs['ImportarPerfil'] = __DIR__ . '/i18n'; diff --git a/www/wiki/extensions/ImportarPerfil/i18n/es.json b/www/wiki/extensions/ImportarPerfil/i18n/es.json new file mode 100644 index 00000000..458446ea --- /dev/null +++ b/www/wiki/extensions/ImportarPerfil/i18n/es.json @@ -0,0 +1,4 @@ +{ + "importarperfil-msg": "Se han importado los datos del [https://red.reevo.org/profile/$1 perfil del usuario $1 de la versión anterior de REEVO] a tu [[Usuario:$1|página de usuario]]", + "importarperfil": "Importar datos del usuario anterior" +} diff --git a/www/wiki/extensions/ImportarPerfil/specials/ImportarPerfil.php b/www/wiki/extensions/ImportarPerfil/specials/ImportarPerfil.php new file mode 100644 index 00000000..72bc2bf5 --- /dev/null +++ b/www/wiki/extensions/ImportarPerfil/specials/ImportarPerfil.php @@ -0,0 +1,27 @@ +<?php + +class DTImportarPerfil extends SpecialPage { + + /** + * Constructor + */ + public function __construct( $name='ImportarPerfil' ) { + parent::__construct( $name ); + } + + public function doesWrites() { + return true; + } + + function execute( $query ) { + $this->setHeaders(); + + global $wgUser; + $currentuser = $wgUser->getName(); + exec('php /srv/reevo-2020/bin/wiki/ImportarPerfil/ImportarPerfil.php -f true -u '.$currentuser); + $text = wfMessage( 'importarperfil-msg', $currentuser); + + $this->getOutput()->addHTML( $text ); + } + +} |