Pagina 1 di 2

disinstallare estensione manualmente

Inviato: 17/05/2016, 12:18
da maurence
Ho installato un estensione che non mi permette più di accedere al PCA, praticamente mi da errore 500.

Quindi ora per ripristinare il tutto dovrei manualmente cancellare e riportare alla norma gli "event" fatti dall'estensione.

Principalmente il problema è sorto dopo aver installato l'estensione upload:

https://www.phpbb.com/customise/db/extension/upload/

e tramite questa ho installato Dysplay Last post

https://www.phpbb.com/customise/db/exte ... ylastpost/

ora nelle due estensioni tovo la cartella event, che da quello che ho capito sono le modifiche che hanno apportato al codice (se mi sbaglio correggetemi)

Partendo da questo file listener.php dell'estensione, in linea teorica se faccio tutto manualmente al contrario dovrei toglierne le tracce.

Codice: Seleziona tutto

<?php
/**
 *
 * Display Last Post extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2013 phpBB Limited <https://www.phpbb.com>
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

namespace Aurelienazerty\DisplayLastPost\event;

/**
 * Event listener
 */
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class listener implements EventSubscriberInterface
{
	
	/** @var \phpbb\db\driver\driver_interface */
	protected $db;

	/** @var \phpbb\config\config */
	protected $config;

	/** @var \phpbb\user $user */
	protected $user;
	
	/** @var int */
	private $last_post_id;

	/**
	 * Constructor
	 *
	 * @param \phpbb\db\driver\driver_interface    $db               DBAL object
	 * @param \phpbb\config\config	$config	Config object
	 * @param \phpbb\user	$user	user object
	 * @return \Aurelienazerty\DisplayLastPost\event\listener
	 * @access public
	 */
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\user $user)
	{
		$this->user = $user;
		$this->config = $config;
		$this->db = $db;
	}

	/**
	 * Assign functions defined in this class to event listeners in the core
	 *
	 * @return array
	 * @static
	 * @access public
	 */
	static public function getSubscribedEvents()
	{
		return array(
			'core.viewtopic_get_post_data'		=> 'modify_viewtopic_post_list',
			'core.viewtopic_modify_post_row'	=> array('modify_first_post_of_the_topic', -2710),
			'core.acp_board_config_edit_add'	=> 'acp_board_post_config',
		);
	}
	
	/**
	 * Modify the firt post of the topic 
	 * (only if it's not the first page)
	 *
	 * @param object $event The event object
	 *
	 * @return null
	 * @access public
	 */
	public function modify_first_post_of_the_topic($event)
	{
		$start = $event['start'];
		if ($this->config['display_last_post_show'] && $start > 0 && $event["post_row"]["POST_ID"] == $this->last_post_id)
		{
			$this->user->add_lang_ext('Aurelienazerty/DisplayLastPost', 'display_last_post');
			$post_row = $event['post_row'];
			$post_row['MESSAGE'] = '<p style="font-weight: bold; font-size: 1em;">' . $this->user->lang['DISPLAY_LAST_POST_TEXT'] . $this->user->lang['COLON'] . '</p>' . $post_row['MESSAGE'];
			$event['post_row'] = $post_row;
		}
	}

	/**
	 * Modify the list of post, to add the previous post of the lastest page
	 * (only if it's not the first page)
	 *
	 * @param object $event The event object
	 *
	 * @return null
	 * @access public
	 */
	public function modify_viewtopic_post_list($event)
	{
		$topic_data = $event['topic_data'];
		$start = $event['start'];
		$sql_ary = $event['sql_ary'];
		$post_list = $event['post_list'];
		if ($this->config['display_last_post_show'] && $start > 0)
		{
			$posts_per_page = $this->config['posts_per_page'];
			$new_post_list = array();
			foreach ($post_list as $key => $value)
			{
				$new_post_list[$key+1] = $value;
			}
			$sql_array = array(
				'SELECT'	=> 'p.post_id',
				'FROM'		=> array(
					POSTS_TABLE	=> 'p',
				),
				'WHERE' => 'p.topic_id = ' . (int) $topic_data['topic_id'],
				'ORDER_BY'  => 'p.post_time'
			);
			$sql = $this->db->sql_build_query('SELECT', $sql_array);
			$result = $this->db->sql_query_limit($sql, 1, $start - 1);
			//Array dereferencing only for php >= 5.4
			$fetchrow = $this->db->sql_fetchrow($result);
			$this->last_post_id = $fetchrow['post_id'];
			$new_post_list[0] = $this->last_post_id; 
			$this->db->sql_freeresult($result);
			$event['post_list'] = $new_post_list;
			$sql_ary['WHERE'] = $this->db->sql_in_set('p.post_id', $new_post_list) . ' AND u.user_id = p.poster_id';
			$event['sql_ary'] = $sql_ary;
		}
	}

	/**
	 * ACP fonction : Adding radio in the post config to switch on/off "Display Last Post" feature
	 *
	 * @param object $event The event object
	 *
	 * @return null
	 * @access public
	 */
	public function acp_board_post_config($event)
	{
		if ($event['mode'] == 'post')
		{
			$display_vars = $event['display_vars'];
			$add_config_var = array(
				'display_last_post_show'	=> array(
					'lang' => 'DISPLAY_LAST_POST_SHOW',
					'validate' => 'bool',
					'type' => 'radio: yes_no',
					'explain' => true,
				)
			);
			$display_vars['vars'] = phpbb_insert_config_array($display_vars['vars'], $add_config_var, array('after' =>'posts_per_page'));
			$event['display_vars'] = array('title' => $display_vars['title'], 'vars' => $display_vars['vars']);
		}
	}
}
E poi fare la stessa cosa con gli event dell'estensione upload:

Codice: Seleziona tutto

<?php
/**
*
* @package Upload Extensions
* @copyright (c) 2014 - 2015 Igor Lavrov (https://github.com/LavIgor) and John Peskens (http://ForumHulp.com)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace boardtools\upload\event;

/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
	protected $user;

	/**
	* Constructor
	*
	* @param \phpbb\user $user User object
	*/
	public function __construct(\phpbb\user $user)
	{
		$this->user = $user;
	}

	static public function getSubscribedEvents()
	{
		return array(
			'core.acp_board_config_edit_add'	=> 'add_config',
		);
	}

	public function add_config($event)
	{
		if ($event['mode'] == 'server')
		{
			$this->user->add_lang_ext('boardtools/upload', 'upload');
			$display_vars = $event['display_vars'];
			$new_vars = array(
				'upload_ext_dir'	=> array('lang' => 'ACP_UPLOAD_EXT_DIR',	'validate' => 'path',	'type' => 'text:20:255', 'explain' => true),
			);
			$display_vars['vars'] = phpbb_insert_config_array($display_vars['vars'], $new_vars, array('after' => 'ranks_path'));
			$event['display_vars'] = $display_vars;
		}
	}
}
Sono sulla giusta linea o sbaglio totalmente?

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 17:11
da frank
Se prima di installare l'estensione avevi un backup, ripristinalo e andrà tutto a posto.

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 18:51
da maurence
frank ha scritto:Se prima di installare l'estensione avevi un backup, ripristinalo e andrà tutto a posto.
Purtroppo è andato bene per qualche giorno (o forse non sono entrato nel PCA)e l'ultimo backup che ho ha già il danno.

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 18:53
da frank
Se il backup è precedente, non può avere il danno.

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 19:26
da maurence
frank ha scritto:Se il backup è precedente, non può avere il danno.
L'ultimo backup che ho non è precedente al fatto, altrimenti avrei risolto :mrgreen:

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 19:30
da frank
Mi sembra strano che installando l'estensione non ti fa entrare nel PCA, non è che magari ha toccato qualcosa?

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 19:33
da maurence
frank ha scritto:Mi sembra strano che installando l'estensione non ti fa entrare nel PCA, non è che magari ha toccato qualcosa?
No, ha funzionato per qualche giorno, poi nulla errore 500 e non mi entra più, da allora le ho provate tutte, ho risolto per breve periodo, facendo backup database cancellando tutto e importando il database, ma poi le cose funzionavano male perché mancavano i file delle estensioni che ho caricato manualmente una alla volta, e se non le caricavo mi usciva la schermata che mancava quel file di quella estensione rimettendole tutte il forum funziona ma non mi accede al PCA.

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 19:36
da frank
Tu riesci ad entrare nel database?

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 19:37
da maurence
frank ha scritto:Tu riesci ad entrare nel database?
Sì certo

Re: disinstallare estensione manualmente

Inviato: 17/05/2016, 20:09
da frank
Bene, entra nel db e seleziona il nome del database.
Schermata 2016-05-17 alle 20.04.09.png
Ora clicca su Cerca e anche qui Seleziona tutto e seleziona il boleano appropriato. Nel campo superiore scrivi il nome dell'estensione + Esegui.
Schermata 2016-05-17 alle 20.06.33.png
Apparirà una schermata con le tabelle che contengono quel nome, eliminali tutti. Poi verifica se entri nel PCA.