Skip to content

Commit

Permalink
[CS-5729] add upgrade script for initializing playlists articles orde…
Browse files Browse the repository at this point in the history
…r, remove some not used files
  • Loading branch information
ahilles107 committed Mar 20, 2015
1 parent a9921ad commit ee75778
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 778 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions newscoop/install/Resources/sql/upgrade/4.1.x/2013-01-14/tables.sql

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

$newscoopDir = realpath(dirname(__FILE__).'/../../../../../../');

require $newscoopDir.'/conf/database_conf.php';
$loader = require $newscoopDir. '/vendor/autoload.php';
// mainly needed to load @Gedmo annotations, but also load other annotations
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

use Monolog\Logger;
use Newscoop\Installer\Services;
use Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;

$upgradeErrors = array();
$app = new Silex\Application();
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => $newscoopDir.'/log/upgrade.log',
'monolog.level' => Logger::NOTICE,
'monolog.name' => 'upgrade',
));

$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'driver' => 'pdo_mysql',
'host' => $Campsite['db']['host'],
'dbname' => $Campsite['db']['name'],
'user' => $Campsite['db']['user'],
'password' => $Campsite['db']['pass'],
'port' => $Campsite['db']['port'],
'charset' => 'utf8',
),
));

$app->register(new DoctrineOrmServiceProvider(), array(
"orm.proxies_dir" => $newscoopDir."/library/Proxy",
"orm.auto_generate_proxies" => false,
"orm.proxies_namespace" => "Proxy",
"orm.em.options" => array(
"mappings" => array(
array(
"type" => "annotation",
"namespace" => "Newscoop\Entity",
"path" => $newscoopDir."/library/Newscoop/Entity",
"use_simple_annotation_reader" => false,
),
array(
"type" => "annotation",
"namespace" => "Newscoop\NewscoopBundle\Entity",
"path" => $newscoopDir."/src/Newscoop/NewscoopBundle/Entity",
"use_simple_annotation_reader" => false,
),
array(
"type" => "annotation",
"namespace" => "Newscoop\Package",
"path" => $newscoopDir."/library/Newscoop/Package",
"use_simple_annotation_reader" => false,
),
array(
"type" => "annotation",
"namespace" => "Newscoop\Image",
"path" => $newscoopDir."/library/Newscoop/Image",
"use_simple_annotation_reader" => false,
),
),
),
));

$logger = $app['monolog'];

try {
$playlists = $app['orm.em']->getRepository('\Newscoop\Entity\Playlist')
->findAll();

foreach ($playlists as $playlist) {
$playlistArticles = $app['orm.em']->getRepository('Newscoop\Entity\Playlist')
->articles($playlist, null, true, null, null, false, true, 'id')
->getResult();

$index = 0;
foreach ($playlistArticles as $article) {
$index++;
$article->setOrder($index);
}
$app['orm.em']->flush();
}
} catch (\Exception $e) {
$msg = $e->getMessage();
$upgradeErrors[] = $msg;
$logger->addError($msg);
array_splice($upgradeErrors, 0, 0, array($msg));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
system php ./init_order_in_playlists.php
25 changes: 0 additions & 25 deletions newscoop/js/models/Slideshow.js

This file was deleted.

Loading

0 comments on commit ee75778

Please sign in to comment.