| 1 |
<?php |
|---|
| 2 |
error_reporting(E_ALL); |
|---|
| 3 |
$app = 'main'; |
|---|
| 4 |
$sf_root = dirname(__FILE__).'/..'; |
|---|
| 5 |
include($sf_root.'/test/bootstrap/functional.php'); |
|---|
| 6 |
include($sf_root.'/lib/symfony/vendor/pake/pakeFunction.php'); |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
$databaseManager = new sfDatabaseManager(); |
|---|
| 10 |
$databaseManager->initialize(); |
|---|
| 11 |
$con = Propel::getConnection(); |
|---|
| 12 |
|
|---|
| 13 |
function _add_tag_for_app($name, $tags) |
|---|
| 14 |
{ |
|---|
| 15 |
$app = ApplicationPeer::retrieveBySlug($name); |
|---|
| 16 |
if (is_null($app)) |
|---|
| 17 |
{ |
|---|
| 18 |
throw new Exception(sprintf('Unknown app %s', $name)); |
|---|
| 19 |
} |
|---|
| 20 |
$app->addTag($tags); |
|---|
| 21 |
$app->save(); |
|---|
| 22 |
pake_echo_action('tags', sprintf('%s for %s', $tags, $app->getName())); |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
function _add_skill_for_person($name, $skills) |
|---|
| 26 |
{ |
|---|
| 27 |
$person = sfGuardUserPeer::retrieveByUsername($name); |
|---|
| 28 |
if (is_null($person)) |
|---|
| 29 |
{ |
|---|
| 30 |
throw new Exception(sprintf('Unknown person %s', $name)); |
|---|
| 31 |
} |
|---|
| 32 |
$person->addSkill($skills); |
|---|
| 33 |
$person->save(); |
|---|
| 34 |
pake_echo_action('skills', sprintf('%s for %s', $skills, $person->getDisplayName())); |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
pake_echo_comment('Adding applications tags'); |
|---|
| 39 |
_add_tag_for_app('dotmarks', 'bookmarks, community'); |
|---|
| 40 |
_add_tag_for_app('symfonians-website', 'network, marketplace, community, social, symfony, jobs'); |
|---|
| 41 |
_add_tag_for_app('motilee', 'forum, community'); |
|---|
| 42 |
_add_tag_for_app('symfony-project', 'bookmarks, community'); |
|---|
| 43 |
_add_tag_for_app('games-officer', 'videogames, shop, marketplace'); |
|---|
| 44 |
_add_tag_for_app('splitgames', 'videogames, marketplace, exchange'); |
|---|
| 45 |
_add_tag_for_app('mageneration-com', 'senior, community, blogs, galleries, photo'); |
|---|
| 46 |
_add_tag_for_app('yahoo-bookmarks', 'community, bookmarks, social, share, yahoo'); |
|---|
| 47 |
_add_tag_for_app('askeet', 'questions, answers, social'); |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
_add_skill_for_person('niko', 'php, symfony, xml, html, css, mysql, flex, flash, ruby, rails'); |
|---|
| 51 |
_add_skill_for_person('mbertier', 'php, symfony, xml, html, css, mysql, python, django'); |
|---|
| 52 |
_add_skill_for_person('francois', 'php, symfony, xml, html, css, mysql, soap, wsdl'); |
|---|
| 53 |
_add_skill_for_person('johndoe', 'php, symfony, xml, html, css'); |
|---|
| 54 |
_add_skill_for_person('fabpot', 'php, symfony, xml, html, css, mysql, postgresql, ruby, rails, python, django'); |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
pake_echo_comment('User accounts operations'); |
|---|
| 58 |
$admin = sfGuardUserPeer::retrieveByUsername('admin'); |
|---|
| 59 |
$admin->delete(); |
|---|
| 60 |
pake_echo_action('users', sprintf('Deleting %s user account', $admin->getUsername())); |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
$niko = sfGuardUserPeer::retrieveByUsername('niko'); |
|---|
| 64 |
$niko->addGroupByName('admin'); |
|---|
| 65 |
pake_echo_action('users', sprintf('Promoting %s as an admin account', $niko->getUsername())); |
|---|
| 66 |
|
|---|