PHP Class Newscoop\Installer\Services\DatabaseService

Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$errorQueries

Protected Properties

Property Type Description
$logger

Public Methods

Method Description
__construct ( object $logger )
createNewscoopDatabase ( Doctrine\DBAL\Connection $connection ) Create Newscoop Database
fillNewscoopDatabase ( Doctrine\DBAL\Connection $connection ) : boolean Fill database with default data and run all not applied upgrades
importDB ( string $sqlFilePath, Doctrine\DBAL\Connection $connection, mixed $logger = null ) : integer Import sql file to databas
installDatabaseSchema ( Doctrine\DBAL\Connection $connection, string $host = null, $publicationName = null ) Install database schema
installSampleData ( Doctrine\DBAL\Connection $connection ) Fill database with sample data
loadGeoData ( Doctrine\DBAL\Connection $connection ) : boolean Fill datatabase with geodata
renderFile ( string $template, string $target, array $parameters ) : boolean Save TWIG template to file
saveDatabaseConfiguration ( Doctrine\DBAL\Connection $connection ) Save database configuration to file
saveDatabaseVersion ( Doctrine\DBAL\Connection $connection, string $version, string $roll ) : boolean Sava new database version in Versions table
searchDbRolls ( string $roll_base_dir, string $last_db_roll ) : array Search for db roll in rols directory
versionCompare ( string $p_version1, string $p_version2 ) : integer Compares versions of Newscoop for upgrades 3.1.0 before 3.1.x, 3.5.2 before 3.5.11

Protected Methods

Method Description
renderTwigTemplate ( string $template, array $parameters ) : string render Twig template

Private Methods

Method Description
combinePaths ( string $dirFirst, string $dirSecond ) : string Puts together two paths, usually an absolute one (directory), plus a relative one (filename)
splitSQL ( string $sqlFile ) : array Split big sql to array fo queries
withMysqlAllIsOk ( $mysqlClientCommand ) : boolean Check if current mysql instance is ok for Newscoop

Method Details

__construct() public method

public __construct ( object $logger )
$logger object

createNewscoopDatabase() public method

Create Newscoop Database
public createNewscoopDatabase ( Doctrine\DBAL\Connection $connection )
$connection Doctrine\DBAL\Connection

fillNewscoopDatabase() public method

Fill database with default data and run all not applied upgrades
public fillNewscoopDatabase ( Doctrine\DBAL\Connection $connection ) : boolean
$connection Doctrine\DBAL\Connection
return boolean

importDB() public method

Import sql file to databas
public importDB ( string $sqlFilePath, Doctrine\DBAL\Connection $connection, mixed $logger = null ) : integer
$sqlFilePath string
$connection Doctrine\DBAL\Connection
$logger mixed
return integer

installDatabaseSchema() public method

Install database schema
public installDatabaseSchema ( Doctrine\DBAL\Connection $connection, string $host = null, $publicationName = null )
$connection Doctrine\DBAL\Connection
$host string

installSampleData() public method

Fill database with sample data
public installSampleData ( Doctrine\DBAL\Connection $connection )
$connection Doctrine\DBAL\Connection

loadGeoData() public method

Fill datatabase with geodata
public loadGeoData ( Doctrine\DBAL\Connection $connection ) : boolean
$connection Doctrine\DBAL\Connection
return boolean

renderFile() public method

Save TWIG template to file
public renderFile ( string $template, string $target, array $parameters ) : boolean
$template string
$target string
$parameters array
return boolean

renderTwigTemplate() protected method

render Twig template
protected renderTwigTemplate ( string $template, array $parameters ) : string
$template string
$parameters array
return string

saveDatabaseConfiguration() public method

Save database configuration to file
public saveDatabaseConfiguration ( Doctrine\DBAL\Connection $connection )
$connection Doctrine\DBAL\Connection

saveDatabaseVersion() public method

Sava new database version in Versions table
public saveDatabaseVersion ( Doctrine\DBAL\Connection $connection, string $version, string $roll ) : boolean
$connection Doctrine\DBAL\Connection
$version string
$roll string
return boolean

searchDbRolls() public method

Search for db roll in rols directory
public searchDbRolls ( string $roll_base_dir, string $last_db_roll ) : array
$roll_base_dir string
$last_db_roll string
return array

versionCompare() public method

Compares versions of Newscoop for upgrades 3.1.0 before 3.1.x, 3.5.2 before 3.5.11
public versionCompare ( string $p_version1, string $p_version2 ) : integer
$p_version1 string
$p_version2 string
return integer

Property Details

$errorQueries public property

public $errorQueries

$logger protected property

protected $logger