Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

Wyłaczenie forum taskiem


AMIGAnTOMEK

Rekomendowane odpowiedzi

Niewiele mam. probowalem "wyciagnac" to podobnie jak w przypadku 2.3.x z tasku (T31) database optimizer ale jak widac jest on pod 3.1 wiec moze cos jest niekompatybilne z 3.2

<?php
/**
* (T31) Database Optimizer
*
* Task: Optimize the database
*
* @author  Terabyte
* @copyright (c) 2006 - 2010 Invision Byte
* @link  http://www.invisionbyte.net/
* @since  10/06/2009
* @updated  06/11/2010
* @version  2.0.0
* @longversion 20000
*/
if ( !defined('IN_IPB') )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class task_item
{
/**
 * Parent task manager class
 *
 * @var  object
 */
protected $class;

/**
 * This task data
 *
 * @var  array
 */
protected $task   = array();

/**
 * Prevent logging
 *
 * @var  boolean
 */
protected $restrict_log = false;

/**
 * Registry Object Shortcuts
 *
 * @var  object
 */
protected $registry;
protected $DB;
protected $settings;
protected $lang;

/**
 * Saves temporarly the actual offline status of the board
 *
 * @var  integer
 */
private $oldOfflineStatus = 0;

/**
 * Saves temporarly the actual offline message
 *
 * @var  string
 */
private $oldOfflineMsg = '';

/**
 * Tables to be skipped from the optimization
 *
 * @var  array
 */
private $skipTables = array();

/**
 * Constructor
 *
 * @param  object  ipsRegistry reference
 * @param  object  Parent task class
 * @param array   This task data
 * @return void
 */
public function __construct( ipsRegistry $registry, $class, $task )
{
 /* Make registry objects */
 $this->registry =  $registry;
 $this->DB	   =  $this->registry->DB();
 $this->settings =& $this->registry->fetchSettings();
 $this->lang	 =  $this->registry->getClass('class_localization');

 $this->class = $class;
 $this->task  = $task;

 /* Load our lang string */
 $this->lang->loadLanguageFile( array( 'public_global' ), 'core' );
}

/**
 * Run this task
 *
 * @return void
 */
public function runTask()

  /* Switch Board status */
  $this->switchBoard();



  /* Switch Board status again =O */
  $this->switchBoard( true );
 }


 /* Unlock task */
 $this->class->unlockTask( $this->task );
}

/**
 * A function to switch the board offline and back online when the task is running
 *
 * @param  boolean True sets the board offline, false turns it back online
 * @return void
 */
private function switchBoard( $online=false )
{
 if ( !$this->settings['tb_do_offline'] )
 {
  return false;
 }

 if ( $online )
 {
  /* Unlock forum */
  IPSLib::updateSettings( array( 'board_offline' => $this->oldOfflineStatus, 'offline_msg' => $this->oldOfflineMsg ) );
 }
 else
 {
  /* Store our current offline status */
  $this->oldOfflineStatus = intval($this->settings['board_offline']);

  /* Get offline messages from DB */
  $this->DB->build( array( 'select' => '*',
	  'from'   => 'core_sys_conf_settings',
	  'where'  => "conf_key IN ('offline_msg','tb_do_message')"
    )  );
  $this->DB->execute();

  $ourOfflineMsg = "";
  while ( $r = $this->DB->fetch() )
  {
   $value = $r['conf_value'] != "" ?  $r['conf_value'] : $r['conf_default'];

   if ( $value == '{blank}' )
   {
 $value = '';
   }

   /* Save our old offline msg  */
   if ( $r['conf_key'] == 'offline_msg' )
   {
 $this->oldOfflineMsg = $value;
   }
   else
   {
 $ourOfflineMsg = $value;
   }
  }

  /* Lock forum */
  IPSLib::updateSettings( array( 'board_offline' => 1, 'offline_msg' => $ourOfflineMsg ) );
 }
}
}

Wywala sie na 108 linii

  $this->switchBoard();

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Brak nawiasu:

public function runTask()
{  
  /* Switch Board status */
  $this->switchBoard();

Ten kod nie miał prawa wcześniej działać.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

<?php
/**
* (T31) Database Optimizer
*
* Task: Optimize the database
*
* @author  Terabyte
* @copyright (c) 2006 - 2010 Invision Byte
* @link  http://www.invisionbyte.net/
* @since  10/06/2009
* @updated  06/11/2010
* @version  2.0.0
* @longversion 20000
*/
if ( !defined('IN_IPB') )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class task_item
{
/**
 * Parent task manager class
 *
 * @var  object
 */
protected $class;
/**
 * This task data
 *
 * @var  array
 */
protected $task   = array();
/**
 * Prevent logging
 *
 * @var  boolean
 */
protected $restrict_log = false;
/**
 * Registry Object Shortcuts
 *
 * @var  object
 */
protected $registry;
protected $DB;
protected $settings;
protected $lang;
/**
 * Saves temporarly the actual offline status of the board
 *
 * @var  integer
 */
private $oldOfflineStatus = 0;
/**
 * Saves temporarly the actual offline message
 *
 * @var  string
 */
private $oldOfflineMsg = '';
/**
 * Tables to be skipped from the optimization
 *
 * @var  array
 */
private $skipTables = array();
/**
 * Constructor
 *
 * @param  object  ipsRegistry reference
 * @param  object  Parent task class
 * @param array   This task data
 * @return void
 */
public function __construct( ipsRegistry $registry, $class, $task )
{
 /* Make registry objects */
 $this->registry =  $registry;
 $this->DB	    =  $this->registry->DB();
 $this->settings =& $this->registry->fetchSettings();
 $this->lang    =  $this->registry->getClass('class_localization');

 $this->class = $class;
 $this->task  = $task;

 /* Load our lang string */
 $this->lang->loadLanguageFile( array( 'public_global' ), 'core' );
}
/**
 * Run this task
 *
 * @return void
 */
public function runTask()
{ 
  /* Switch Board status */
  $this->switchBoard();



  /* Switch Board status again =O */
  {
  $this->switchBoard( true );
 }


 /* Unlock task */
 {
 $this->class->unlockTask( $this->task );
}
/**
 * A function to switch the board offline and back online when the task is running
 *
 * @param  boolean True sets the board offline, false turns it back online
 * @return void
 */
 {
private function switchBoard( $online=false )
}
{
 if ( !$this->settings['tb_do_offline'] )
 {
  return false;
 }

 if ( $online )
 {
  /* Unlock forum */
  IPSLib::updateSettings( array( 'board_offline' => $this->oldOfflineStatus, 'offline_msg' => $this->oldOfflineMsg ) );
 }
 else
 {
  /* Store our current offline status */
  $this->oldOfflineStatus = intval($this->settings['board_offline']);

  /* Get offline messages from DB */
  $this->DB->build( array( 'select' => '*',
			  'from'   => 'core_sys_conf_settings',
			  'where'  => "conf_key IN ('offline_msg','tb_do_message')"
	    )  );
  $this->DB->execute();

  $ourOfflineMsg = "";
  while ( $r = $this->DB->fetch() )
  {
   $value = $r['conf_value'] != "" ?  $r['conf_value'] : $r['conf_default'];

   if ( $value == '{blank}' )
   {
	 $value = '';
   }

   /* Save our old offline msg  */
   if ( $r['conf_key'] == 'offline_msg' )
   {
	 $this->oldOfflineMsg = $value;
   }
   else
   {
	 $ourOfflineMsg = $value;
   }
  }

  /* Lock forum */
  IPSLib::updateSettings( array( 'board_offline' => 1, 'offline_msg' => $ourOfflineMsg ) );
 }
}
}

Parse error: syntax error, unexpected T_PRIVATE in /home/renaultlaguna.pl/public_html/forum/qrwajasna/applications/core/tasks/on32.php on line 127

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Możesz mi wyjaśnić po co takie coś robisz:

  {
private function switchBoard( $online=false )
}
{

Jak wyraźnie napisałem, jak ma to wyglądać.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.