-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CS-5729] add upgrade script for initializing playlists articles orde…
…r, remove some not used files
- Loading branch information
1 parent
a9921ad
commit ee75778
Showing
37 changed files
with
94 additions
and
778 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
newscoop/application/modules/admin/views/scripts/comment-action.phtml
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
newscoop/application/modules/admin/views/scripts/comment-article.phtml
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
newscoop/application/modules/admin/views/scripts/comment-commenter.phtml
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
newscoop/application/modules/admin/views/scripts/comment-index.phtml
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
newscoop/application/modules/admin/views/scripts/comment-message.phtml
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
newscoop/application/modules/admin/views/scripts/moderate-body-comment.phtml
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
newscoop/application/modules/admin/views/scripts/moderate-subject-comment.phtml
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
newscoop/install/Resources/sql/upgrade/4.1.x/2013-01-14/tables.sql
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
newscoop/install/Resources/sql/upgrade/4.1.x/2013-01-23/tables.sql
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
newscoop/install/Resources/sql/upgrade/4.1.x/2013-02-06/data-required.sql
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
newscoop/install/Resources/sql/upgrade/4.1.x/2013-04-12/data-required.sql
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
newscoop/install/Resources/sql/upgrade/4.1.x/2013-04-22/tables.sql
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
newscoop/install/Resources/sql/upgrade/4.4.x/2015.03.19/init_order_in_playlists.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} |
1 change: 1 addition & 0 deletions
1
newscoop/install/Resources/sql/upgrade/4.4.x/2015.03.19/tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
system php ./init_order_in_playlists.php |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.