Pedro Oliver Posted May 22, 2012 Share Posted May 22, 2012 Hola, Estoy buscando como loco la manera de llamar a la clase Backup desde un modulo, pero ni papa. Se que es una tontería puetso que ya está hecho en admin tabs, pero, he hecho un modulo y quiero meterle un boton que diga Backup y al apretarlo llame a donde tenga que llamar para hacer un backup completo de la base de datos. Pero si intento: Backup::add(); Me pide la variable psBackupAll. Y no veo la forma de decirle que esa variable la tiene en el construct. Es lo unico qu eme falla. Eso me ahorraría muchisima incompatvilidad en mi modulo. Un saludo y gracias. Se agradecen ideas Link to comment Share on other sites More sharing options...
Pedro Oliver Posted May 22, 2012 Author Share Posted May 22, 2012 nadie? Link to comment Share on other sites More sharing options...
PSS Posted May 23, 2012 Share Posted May 23, 2012 (edited) add() no es una función estática. Deberías de llamarla de forma: $miBackup = new Backup(); $miBackup->add(); y por lo que veo en el código de Backup.php (versión PS 1.4.7.3), el constructor si la rellena public function __construct($filename = NULL) { if ($filename) $this->id = $this->getRealBackupPath($filename); $psBackupAll = Configuration::get('PS_BACKUP_ALL'); $psBackupDropTable = Configuration::get('PS_BACKUP_DROP_TABLE'); $this->psBackupAll = $psBackupAll !== false ? $psBackupAll : true; $this->psBackupDropTable = $psBackupDropTable !== false ? $psBackupDropTable : true; } Edito: Dejo la función Backup() sin parámetro, ya que si no da error la llamada. Edited May 24, 2012 by PSS (see edit history) Link to comment Share on other sites More sharing options...
nadie Posted May 23, 2012 Share Posted May 23, 2012 add() no es una función estática. Deberías de llamarla de forma: $miBackup = new Backup($filename); $miBackup->add(); y por lo que veo en el código de Backup.php (versión PS 1.4.7.3), el constructor si la rellena public function __construct($filename = NULL) { if ($filename) $this->id = $this->getRealBackupPath($filename); $psBackupAll = Configuration::get('PS_BACKUP_ALL'); $psBackupDropTable = Configuration::get('PS_BACKUP_DROP_TABLE'); $this->psBackupAll = $psBackupAll !== false ? $psBackupAll : true; $this->psBackupDropTable = $psBackupDropTable !== false ? $psBackupDropTable : true; } Hola PSS! Te animo, a que hagas un ejemplo del funcionamiento de la llamada a la clase backup en esta sección: (creando un nueva tema en tal sección) http://www.prestasho...ambian-la-vida/ Link to comment Share on other sites More sharing options...
PSS Posted May 24, 2012 Share Posted May 24, 2012 En este tema lo explico mejor: http://www.prestashop.com/forums/topic/170702-aporte-crear-copias-de-seguridad-desde-codigo/ Link to comment Share on other sites More sharing options...
nadie Posted May 24, 2012 Share Posted May 24, 2012 En este tema lo explico mejor: http://www.prestasho...d-desde-codigo/ Vamos a echarle un vistazo. Un Saludo y gracias por el aporte para la comunidad! Link to comment Share on other sites More sharing options...
Recommended Posts