示例#1
0
<?php

//vendor/claroline/core-bundle/Claroline/CoreBundle/Library/Installation/src.
// ..   / ..  /       ..      /    ..    / ..      /  ..   /   ..       /.. ||8
//This will execute the operations.xml file.
//You shouldn't execute it manually.
require_once __DIR__ . '/../../../../../../../../app/bootstrap.php.cache';
require_once __DIR__ . '/../../../../../../../../app/AppKernel.php';
use Claroline\CoreBundle\Library\Installation\Refresher;
use Symfony\Component\Console\Output\StreamOutput;
//The cache must be cleared first.
$cacheDir = __DIR__ . '/../../../../../../../../app/cache';
Refresher::removeContentFrom($cacheDir);
$kernel = new AppKernel('dev', true);
//'prod',  false pour l'env de prod
$kernel->loadClassCache();
$kernel->boot();
$container = $kernel->getContainer();
$bundleManager = $container->get('claroline.manager.bundle_manager');
$bundleManager->executeOperationFile($argv[1]);
示例#2
0
use Claroline\BundleRecorder\Operation;
use Claroline\BundleRecorder\Handler\OperationHandler;
use Claroline\BundleRecorder\Detector\Detector;
use Claroline\BundleRecorder\Handler\BundleHandler;
use Claroline\BundleRecorder\Recorder;
use Psr\Log\LogLevel;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\HttpFoundation\Request;
use Claroline\CoreBundle\Library\Installation\Refresher;
require_once __DIR__ . "/../../app/AppKernel.php";
$logLine = "Emptying the cache...\n";
file_put_contents($logFile, $logLine . "\n", FILE_APPEND);
Refresher::removeContentFrom($vendorDir . '/../app/cache');
//we can also get the PDO connection from the sf2 container.
//database parameters from the parameters.yml file
$value = Yaml::parse($configDir . '/parameters.yml');
$host = $value['parameters']['database_host'];
$dbName = $value['parameters']['database_name'];
//dsn driver... hardcoded. Change this if you really need it.
//or use the connexion from sf2
$driver = 'mysql';
$dsn = "{$driver}:host={$host};dbname={$dbName}";
$username = $value['parameters']['database_user'];
$password = $value['parameters']['database_password'];
//create connection
$conn = new \PDO($dsn, $username, $password, array());
//Let's use stefk stuff !
$operationFilePath = __DIR__ . "/../../app/config/operations.xml";