PHP Classes

File: example/index.php

Recommend this page to a friend!
  Classes of Alexsandro Souza   Update Environment   example/index.php   Download  
File: example/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Update Environment
Update database and files from a remote server
Author: By
Last change:
Date: 12 years ago
Size: 1,845 bytes
 

Contents

Class file image Download
<?php
// remote access db
define(REMOTE_DB_TIPO, 'mysql');
define(REMOTE_DB_PORT, '');
define(REMOTE_DB_NAME, 'blowtex');
define(REMOTE_DB_USER, 'root');
define(REMOTE_DB_PASS, 'salve');
define(REMOTE_DB_HOST, 'salveweb');


//local access db
define(LOCAL_DB_TIPO, 'mysql');
define(LOCAL_DB_PORT, '');
define(LOCAL_DB_NAME, 'test');
define(LOCAL_DB_USER, 'root');
define(LOCAL_DB_PASS, '');
define(LOCAL_DB_HOST, 'localhost');

define(RECORD_LIMIT, 50);
define(PATH_COMPLEMENT, '');


require
'Product.class.php';
require
'Customer.class.php';
require
'../class/DataBase.class.php';
require
'../class/Download.class.php';
require
'../class/RecordFilter.class.php';
require
'../class/UpdateDataBase.class.php';


$aModelOfTable = array(
   
'customer' => array( //name table
       
'class'=>'Customer', //class model of table
       
'constPath'=>'DIR_FILE', // constant of class model with the path of the files
       
'thumb' =>array('t1_','t2_'), //abbreviation of the thumb of the file
       
'columnOrder' =>'id', //column used to sort the results of queries
       
'columnDownload' =>'file'//column that usually saves the files to be downloaded, it does not contain this column in the table, the component filters all columns by searching for valid, current gif, jpg, png and pdf
   
),
   
'product' => array(
       
'class'=>'Product',
       
'constPath'=>'DIR_FILE',
       
'thumb' =>array('t1_','t2_'),
       
'columnOrder' =>'dateinsert'
   
)
);

//array with the tables that should not be updated
$aExcludeTable = array(
   
'brasil_cidade',
   
'brasil_estado'
);



$urlRemote = 'http://www.yoursite.com.br/';
$updateDb = new UpdateDataBase($urlRemote,$aModelOfTable);
$updateDb->update($aExcludeTable);

$download = new Download($aModelOfTable,$urlRemote);
$download->getRecords($aExcludeTable);
$download->downloadNow();

exit;