Latest 100 public snipts »
toledot's
snipts
showing 1-17 of 17 snipts
-
∞ suchen in linux
grep -H -r "muster" * -
∞ batch delete in symfony 1.2
<?php // actions.class.php in module semester class semesterActions extends sfActions{ //batch action to delete all selected semesters public function executeBatchDelete(sfWebRequest $request){ //get the values of ids from form $ids = $request->getParameter('ids'); //count to count the number of selected semesters $count = 0; //foreach semester object foreach (SemesterPeer::retrieveByPks($ids) as $semester) { //$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $object))); //delete this object $semester->delete(); if ($semester->isDeleted()) { //count the deleted semester object $count++; } }//end foreach if ($count == count($ids) && $count != 0) { $this->getUser()->setFlash('feedback_delete', 'The selected items have been deleted successfully.'); } else { if(count($ids) == 0){ $this->getUser()->setFlash('error', 'You must at least select one item.'); }else{ $this->getUser()->setFlash('error', 'A problem occurs when deleting the selected items.'); } } $this->redirect('semester/index'); }//end batchDelete() } // **************************************************************** // in _list_members.php template, add javascript script to select the item to delete <form action="<?php echo url_for('semester/batchDelete') ?>" name="batchform" method="post"> <table id="data-table" class="data-table no-arrow"> <colgroup> <col width="10px"><col><col><col><col width="100px"> </colgroup> <thead align="center"> <tr> <th class="unsortable"><input id="checkbox_checkall" type="checkbox" onclick="checkAll();"/></th> <th class="sortable-numeric"> <?php echo __('Id') ?> </th> <th class="sortable-text"> <?php echo __('Name') ?> </th> <th class="sortable-date" id="year"> <?php echo __('Year') ?></th> <th class="unsortable"></th> </tr> </thead> <tbody> <?php foreach ($semester_list as $i=>$semester): ?> <?php if($i % 2): ?> <tr> <?php else: ?> <tr class="alt"> <?php endif; ?> <td><input class="checkbox_item" type="checkbox" value="<?php echo $semester->getId() ?>" name="ids[]"></td> <td><a href="<?php echo url_for('semester/show?id='.$semester->getId()) ?>"><?php echo $semester->getId() ?></a></td> <td><?php echo $semester->getName() ?></td> <td><?php echo $semester->getYear() ?></td> <td> <?php echo jq_link_to_remote(image_tag('icons/delete',array('id'=>sprintf('delete%s',$semester->getId()))), array( 'update' => 'list', 'url' => 'semester/delete?id='.$semester->getId(), 'loading' => jq_visual_effect('fadeIn', sprintf('#loader%s',$semester->getId())), 'complete' => jq_visual_effect('fadeOut', sprintf('#loader%s',$semester->getId())), ),array( 'confirm' => sprintf('Are you sure to delete Semester [%s]?', $semester), 'title'=>'delete this entry' ) )?> <?php echo jq_link_to_remote(image_tag('icons/edit',array('title'=>'edit this entry')),array( 'update' => 'update_form_table', 'url' => 'semester/edit?id='.$semester->getId(), 'complete'=> '$.scrollTo("#update_form_table",800)' )) ?> <?php echo jq_link_to_remote(image_tag('icons/more',array('title'=>'show the detail')),array( 'update' => 'GB_content', 'url' => 'semester/show?id='.$semester->getId(), 'complete' => jq_visual_effect('fadeIn', '#GB_overlay').'$.scrollTo("#GB_windwo",200)', )) ?> <!-- loading image --> <?php echo image_tag('loader.gif',array('class'=>'hide','id'=>sprintf('loader%s',$semester->getId()))); ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php echo javascript_tag(" function submitBatchForm(){ document.batchform.submit(); } ") ?> <div id="batch_menu"> <ul class="no_style"> <li><input type="submit" value="Delete Selection" onclick="form.action='semester/batchDelete'"/></li> <li><input type="submit" value="Detail Selection" onclick="form.action='semester/batchDetail'"/></li> </ul> </div> </form>
-
∞ restore DB with PHP script+ajax
<?php //restore.php to restore DB with SQL dump file,please look at backup.php in snipts include('db_config.php'); //$files =scandir($backup_dir); //$filepath = $backup_dir.$files[2]; $filepath =getNewestFile(getPathOfFiles($backup_dir)); restore($dbhost, $dbuser, $dbpassword, $dbname, $filepath); echo sprintf('[%s] DB restored successed !<br><small>Used %s</small><br>',date('Y-m-d H:i:s'),$filepath); //get filepath of newest file in $backup_dir function getNewestFile($path_array){ //init. datetime with the value of first file $max_datetime = filemtime($path_array[0]); //init. index with 0 $newest = 0; //find the newest file foreach($path_array as $i=> $path){ //if its datetime bigger, means it is newer. if(filemtime($path) > $max_datetime){ $max_datetime = filemtime($path); $newest= $i; } } //return the filePath of newest file return $path_array[$newest]; }//end getNewestFile() //build a array of filepath, in order to find the newest file with filemtime() function getPathOfFiles($backup_dir){ //create a new array to store the pathes $path_array = array(); $files =scandir($backup_dir);//return a array of filenames foreach($files as $file){ if($file != '.' && $file !='..'){//we don't need the dir '.' and '..' $path_array[] = $backup_dir.$file;//build the path and put it in array } } //return a array of filepath as result return $path_array; }//end getPathOfFiles() function restore($dbhost, $dbuser, $dbpassword, $dbname, $filepath) { // Connect to MySQL server mysql_connect($dbhost, $dbuser, $dbpassword) or die('Error connecting to MySQL server: ' . mysql_error()); // Select database mysql_select_db($dbname) or die('Error selecting MySQL database: ' . mysql_error()); // Temporary variable, used to store current query $templine = ''; // Read in entire file $lines = file($filepath); // Loop through each line foreach ($lines as $line) { // Skip it if it's a comment if (substr($line, 0, 2) == '--' || $line == '') continue; // Add this line to the current segment $templine .= $line; // If it has a semicolon at the end, it's the end of the query if (substr(trim($line), -1, 1) == ';') { // Perform the query mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />'); // Reset temp variable to empty $templine = ''; } }//end foreach }//end restore() ?>
-
∞ backup DB with PHP script+Ajax
<?php // in adminDBSuccess.php template file, call another action "ajaxBackup" with Ajax echo jq_link_to_remote(image_tag('backup'), array ( 'update' =>'feedback_backup', 'url' =>'homepage/ajaxBackup', 'loading' => jq_visual_effect('fadeIn', '#indicator_backup'), 'complete'=> jq_visual_effect('fadeOut', '#indicator_backup') )); ?> // action ajaxBackup in actions.class.php public function executeAjaxBackup(sfWebRequest $request) { return $this->renderPartial('homepage/backupDBSuccess'); } //_backupDBSuccess.php partial template <?php if(!require_once(dirname(__FILE__).'/../../../../../web/backup.php')): ?> <?php echo "backup.php file not found or it doesn't work correctly." ?> <?php endif; ?> // backup.php script to backup DB <?php include('db_config.php'); backup_tables($dbhost,$dbuser,$dbpassword,$dbname,$tables, $backup_dir); /* backup the db OR just a table */ function backup_tables($host,$user,$pass,$name,$tables, $backup_dir) { $return =''; $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the tables if($tables == '*') { $tables = array(); $result = mysql_query('SHOW TABLES'); while($row = mysql_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',',$tables); } //cycle through $return.='SET FOREIGN_KEY_CHECKS=0;'."\n"; foreach($tables as $table) { $result = mysql_query('SELECT * FROM '.$table); $num_fields = mysql_num_fields($result); $return.= 'DROP TABLE '.$table.';'; $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table)); $return.= "\n\n".$row2[1].";\n\n"; for ($i = 0; $i < $num_fields; $i++) { while($row = mysql_fetch_row($result)) { $return.= 'INSERT INTO '.$table.' VALUES('; for($j=0; $j<$num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n","\\n",$row[$j]); if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; } if ($j<($num_fields-1)) { $return.= ','; } } $return.= ");\n"; } } $return.="\n\n\n"; } $return.='SET FOREIGN_KEY_CHECKS=1;'." \n"; //save file //$handle = fopen($backup_dir.'db-backup-'.date('Y-m-d').'-'.(md5(implode(',',$tables))).'.sql','w+'); $filename = date('Y-m-d_H:i:s').'.sql'; $handle = fopen($backup_dir.$filename,'w+'); fwrite($handle,$return); echo sprintf('[%s] DB backup successed !<br> <small>%s</small><br>',date('Y-m-d H:i:s'),$backup_dir.$filename); fclose($handle); }//end function // DB configuration file db_config.php <?php // please configurate here your db connection and path of backup $dbhost = "localhost"; $dbname = "kqb"; $dbuser = "root"; $dbpassword = "something"; $tables ='*'; //if only one table should be saved, give the name of table. Default *, means any table in DB $backup_dir ='/var/www/clean/kqb-v2/backup/'; // Folder where sql should be stored, please "chmodd 777 $backup_dir"
-
∞ hide a widget with default value in symfony 1.2
<?php // to hide a widget with default value $this->setWidget('conference_id', new sfWidgetFormInputHidden(array(),array('value' => ConferencePeer::getActiveConferenceId())));
-
∞ submit a form when a hyperlink or image is clicked
// Sample code 1: pure PHP and javascript <form name="myform" action="handle-data.php"> Search: <input type='text' name='query' /> <a href="javascript: submitform()">Search</a> </form> <script type="text/javascript"> function submitform() { document.myform.submit(); } </script> //Sample code 2: symfony and jQueryHelper // form to submit <form action="<?php echo url_for('semester/batchDelete') ?>" name="batchform" method="post"> </form> //define a method to submit form in javascript <?php echo javascript_tag(" function submitBatchForm(){ document.batchform.submit(); } ") ?> <?php echo jq_link_to_function('delete selection', 'submitBatchForm()') ?>
-
∞ hide or close div with jq_link_to_remote, jquery, jq_visual_effect
<div id="feedback" class="hide">feedback: </div> <?php echo jq_link_to_function('show secret div','$("#feedback").removeClass("hide")') ?> <?php echo jq_link_to_function('hide secret div','$("#feedback").addClass("hide")') ?> <?php echo jq_link_to_function('show secret div with effect',jq_visual_effect('fadeIn', '#feedback'),) ?> <?php echo jq_link_to_function('show secret div with effect',jq_visual_effect('fadeOut', '#feedback'),) ?> <?php echo jq_link_to_function('show secret div with effect','$("#feedback").fadeIn(1000)') ?> <?php echo jq_link_to_function('show secret div with effect','$("#feedback").fadeOut(1000)') ?> <?php echo jq_link_to_function('show secret div with effect',jq_visual_effect('slideDown', '#feedback'),) ?> <?php echo jq_link_to_function('hide secret div with effect',jq_visual_effect('slideUp', '#feedback'),) ?>
-
∞ create DB utf8
CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;
-
∞ view symfony log file
$ tail -f log/frontend_dev.log -
∞ PHP reads from text file and write into YML file
<? $arr=file("province.txt");// the txt file to be read // read the data from province.txt and write into 02_district.yml $myFile = "02_district.yml"; //open a new file with name $myFile, if permission is dennied, throws message $fh = fopen($myFile, 'w') or die("can't open file"); // write the head in YML file without backspace $head= "District:\n"; fwrite($fh, $head); $i = 0; $k = 0; $tmp = "province"; foreach($arr as $str) { $k++; // split $str, if digits were found list($province,$district)=preg_split("/[\d]+/", $str);; /*echo "<ul>"; echo "<li>".$province; echo "<li>".$district; echo "</ul>"; echo "<hr>";*/ $district_id = " District_".$k.":\n";// \n change line $district_name = " name: ".$district.""; if($tmp != $province){//if province is changed, increase the id of province $i++; $tmp = $province; } $province_id = " province_id: Province_".$i."\n"; fwrite($fh, $district_id);//write the value in file fwrite($fh, $district_name); fwrite($fh, $province_id); } fclose($fh); ?> // this is text file to be read by PHP script Nuristan 3001 Nuristan Nuristan 3002 Kamdesh Nuristan 3003 Waygal Nuristan 3004 Mandol Nuristan 3005 Bargi Matal Nuristan 3006 Wama Nuristan 3007 Du Ab Nuristan 3008 Nurgaram Sari Pul 3101 Sari Pul Sari Pul 3102 Sangcharak Sari Pul 3103 Kohistanat Sari Pul 3104 Balkhab Sari Pul 3105 Sozma Qala Sari Pul 3106 Sayyad Sari Pul 3107 Gosfandi
-
∞ Form Filter: choice widget for text field
<?php // sfGuardPlugin/lib/filter/sfGuardUserProfileFormFilter.class.php class sfGuardUserProfileFormFilter extends BasesfGuardUserProfileFormFilter { public function configure() { //drop down list for profession $this->widgetSchema['profession'] = new sfWidgetFormChoice(array( 'choices' => sfGuardUserPeer::getFilterProfessions(), )); $this->validatorSchema['profession'] = new sfValidatorChoice(array( 'choices' => array_keys(sfGuardUserPeer::getFilterProfessions()) )); //drop down list for access level $this->widgetSchema['accesslevel'] = new sfWidgetFormChoice(array( 'choices' => sfGuardUserPeer::getFilterLevels(), )); $this->validatorSchema['accesslevel'] = new sfValidatorChoice(array( 'choices' => array_keys(sfGuardUserPeer::getFilterLevels()) )); } //end configure() // overwrite the method convertProfessionValue(), // if field "profession" is not selected, public function convertProfessionValue($value) { return $value != 'none' ? $value : false; } public function convertAccesslevelValue($value) { return $value != 'none' ? $value : false; } //overwrite getFields() from parent class,and change profession, accesslevel into ForeignKey public function getFields() { return array( 'profession' => 'ForeignKey', 'accesslevel' => 'ForeignKey', 'categories_id' => 'ForeignKey', ); }//end getFields() } <?php /** * * sfGuardUserPeer */ class sfGuardUserPeer extends PluginsfGuardUserPeer { // defining the user types static public $theUserType = array( '0' => 'Technical', '1' => 'Internal', '2' => 'External' ); static public function getFilterLevels() { return array_merge(array('none' => ''), self::$theUserType); } // defining the profession static public $theProfession = array( 'lecturer' => 'Lecturer', 'researcher' => 'Researcher', 'student' => 'Student', 'other' => 'Other' ); static public function getFilterProfessions() { return array_merge(array('none' => ''), self::$theProfession); } }// endd sfGuardUserPeer
-
∞ update password sfGuardUser
<?php public function executeChangepassword(sfWebRequest $request) { if($this->getRequest()->getMethod() != sfRequest::POST) { return sfView::SUCCESS; } else { $cpassword = $request->getParameter("cpass"); //current pword $npassword = $request->getParameter("npass"); //new pword $cnpassword = $request->getParameter("cnpass"); //commit pword $this_user = $this->getUser()->getGuardUser(); //sfGuardUser Object // if the current password matches the password saved in the database if($this_user->checkPassword($cpassword)) { // if the new password has been entered twice correctly if($npassword==$cnpassword) { // the new password should be inserted in the password field in db $this_user->setPassword($npassword); $this_user->save(); //update db // set feedback message $this->getUser()->setFlash('message','The password has been updated successfully.'); } } } }
-
∞ symfony form snipts 01
<? //set default value $user_church = sfContext::getInstance()->getUser()->getGuardUser()->getChurchId(); $this->setDefault('church_id', $user_church); // change the labels for a form $this->widgetSchema->setLabels(array( 'category_id'=>'Category', 'is_public'=>'public ?', )); // move field within widget $this->widgetSchema->moveField('password_again', 'after', 'password'); //hidden input with default value $this->setWidget('conference_id', new sfWidgetFormInputHidden(array(),array('value' => ConferencePeer::getActiveConferenceId())));
-
∞ Propel VS Doctrine in symfony
<?php //Retrieving an article by its primary key // Propel $article = ArticlePeer::retrieveByPk(123); // Doctrine $article = Doctrine::getTable('Article')->find(123); // sfPropelFinder $article = sfPropelFinder::from('Article')->findPk(123); //Retrieving the comments related to an article // Propel $comments = $article->getComments(); // Doctrine $comments = $article->Comments; // sfPropelFinder $comments = $article->getComments(); // no change – use Propel Retrieving an article from its title // Propel $c = new Criteria(); $c->add(ArticlePeer::TITLE, 'FooBar'); $article = ArticlePeer::doSelectOne($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> where('a.title = ?', array('FooBar'))-> fetchOne(); // Doctrine (faster) $article = Doctrine::getTable('Article')-> findOneByTitle('FooBar'); // sfPropelFinder $article = sfPropelFinder::from('Article')-> where('Title', 'FooBar')-> findOne(); // sfPropelFinder (faster) $article = sfPropelFinder::from('Article')-> findOneByTitle('FooBar'); Retrieving the latest 5 articles // Propel $c = new Criteria(); $c->addDescendingOrderByColumn(ArticlePeer::PUBLISHED_AT); $c->setLimit(5); $articles = ArticlePeer::doSelect($c); // Doctrine $articles = Doctrine_Query::create()-> from('Article a')-> orderby('a.published_at DESC')-> limit(5)-> execute(); // sfPropelFinder $articles = sfPropelFinder::from('Article')-> orderBy('PublishedAt', 'desc')-> find(5); Retrieving the last 5 comments related to an article // Propel $c = new Criteria(); $c->addDescendingOrderByColumn(CommentPeer::PUBLISHED_AT); $c->setLimit(5); $comments = $article->getComments($c); // Doctrine $comments = Doctrine_Query::create()-> from('Comment c')-> where('c.article_id = ?', array($article->getId()))-> orderby('c.published_at DESC')-> limit(5)-> execute(); // sfPropelFinder $comments = sfPropelFinder::from('Comment')-> relatedTo($article)-> orderBy('PublishedAt', 'desc')-> find(5); Retrieving the last comment related to an article // Propel $c = new Criteria(); $c->addDescendingOrderByColumn(CommentPeer::PUBLISHED_AT); $c->add(CommentPeer::ARTICLE_ID, $article->getId()); $comment = CommentPeer::doSelectOne($c); // Doctrine $comments = Doctrine_Query::create()-> from('Comment c')-> where('c.article_id = ?', array($article->getId()))-> orderby('c.published_at DESC')-> fetchOne(); // sfPropelFinder $comments = sfPropelFinder::from('Comment')-> relatedTo($article)-> findLast(); Retrieving articles based on a word appearing in the title or the summary // Propel $c = new Criteria(); $cton1 = $c->getNewCriterion(ArticlePeer::TITLE, '%FooBar%', Criteria::LIKE); $cton2 = $c->getNewCriterion(ArticlePeer::SUMMARY, '%FooBar%', Criteria::LIKE); $cton1->addOr($cton2); $c->add($cton1); $articles = ArticlePeer::doSelect($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> where('a.title like ? OR a.summary like ?', array('%FooBar%', '%FooBar%'))-> execute(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> where('Title', 'like', '%FooBar%')-> _or('Summary', 'like', '%FooBar%')-> find(); Retrieving articles based on a complex AND/OR clause // Articles having name or summary like %FooBar% and published between $begin and $end // Propel $c = new Criteria(); $cton1 = $c->getNewCriterion(ArticlePeer::TITLE, '%FooBar%', Criteria::LIKE); $cton1 = $c->getNewCriterion(ArticlePeer::SUMMARY, '%FooBar%', Criteria::LIKE); $cton1->addOr($cton2); $c->add($cton1); $c->add(ArticlePeer::PUBLISHED_AT, $begin, Criteria::GREATER_THAN); $c->addAnd(ArticlePeer::PUBLISHED_AT, $end, Criteria::LESS_THAN); $article = ArticlePeer::doSelect($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> where('(a.title like ? OR a.summary like ?) and (article.published_at> ? and article.published_at> ?)', array('%FooBar%', '%FooBar%', $begin, $end))-> execute(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> where('Title', 'like', '%FooBar%', 'cond1?)-> where('Summary', 'like', '%FooBar%', 'cond2?)-> combine(array('cond1?, 'cond2?), 'or', 'cond3?)-> where('PublishedAt', '>', $begin, 'cond4?)-> where('PublishedAt', '<', $end, 'cond5?)-> combine(array('cond4?, 'cond5?), 'and', 'cond6?)-> combine(array('cond3?, 'cond6?), 'and')-> find(); Retrieving articles authored by someone // Propel $c = new Criteria(); $c->addJoin(ArticlePeer::AUTHOR_ID, AuthorPeer::ID); $c->add(AuthorPeer::NAME, 'John Doe'); $articles = ArticlePeer::doSelect($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> leftJoin('a.Author b')-> where('b.name = ?', array('John Doe'))-> execute(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> where('Author.Name', 'John Doe')-> // Guesses the join from the schema find(); Retrieving articles authored by people of a certain group // Propel $c = new Criteria(); $c->addJoin(ArticlePeer::AUTHOR_ID, AuthorPeer::ID); $c->addJoin(AuthorPeer::GROUP_ID, GroupPeer::ID); $c->add(GroupPeer::NAME, 'The Foos'); $articles = ArticlePeer::doSelect($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> leftJoin('a.Author b')-> leftJoin('b.Group c')-> where('c.name = ?', array('The Foos'))-> execute(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> join('Author')-> where('Group.Name', 'The Foos')-> // Guesses the Group join from the schema find(); Retrieving all articles and hydrating their category object in the same query // Propel $c = new Criteria(); $articles = ArticlePeer::doSelectJoinCategory($c); // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> leftJoin('a.Category c')-> execute(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> with('Category')-> find(); Retrieving an article and its category by the article primary key // Propel $c = new Criteria(); $c->add(ArticlePeer::ID, 123); $c->setLimit(1); $articles = ArticlePeer::doSelectJoinCategory($c); $article = isset($articles[0]) ? $articles[0] : null; // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> leftJoin('a.Category c')-> where('a.id = ?', array(123))-> fetchOne(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> with('Category')-> findPk(123); Retrieving articles and hydrating their author object and the author group // Propel // Impossible do to it simply – need for a custom hydration method (approx 40 LOC) // Doctrine $article = Doctrine_Query::create()-> from('Article a')-> leftJoin('a.Author b')-> leftJoin('b.Group c')-> where('a.id = ?', array(123))-> fetchOne(); // sfPropelFinder $article = sfPropelFinder::from('Article')-> with('Category', 'Group')-> findPk(123);
-
∞ clean local copy from SVN symfony project
1 create batch_local.txt file in project folder with this content for DIR in `find -name sql -type d`; do svn propset svn:ignore '*' $DIR/; done; for DIR in `find -name log -type d`; do svn propset svn:ignore '*' $DIR/; done; for DIR in `find -name cache -type d`; do svn propset svn:ignore '*' $DIR/; done; for DIR in `find -name base -type d`; do svn propset svn:ignore '*' $DIR/; done; for DIR in `find -name om -type d`; do svn propset svn:ignore '*' $DIR/; done; for DIR in `find -name map -type d`; do svn propset svn:ignore '*' $DIR/; done; svn commit -m 'change svn properties' svn status 2 $chmod +x batch_local.txt 3 $./batch_local.txt
-
∞ clean copy of symfony project for trac by using batch command
1 create batch_trac.txt in project folder with this content mv config/databases.yml config/databases.yml.sample; mv config/ProjectConfiguration.class.php config/ProjectConfiguration.class.php.sample; rm -rf cache/* log/*; find -name *schema.sql -exec rm -rf {} \; for DIR in `find -name base -type d`; do rm -rf $DIR/*;done; for DIR in `find -name map -type d`; do rm -rf $DIR/*;done; for DIR in `find -name om -type d`; do rm -rf $DIR/*;done; echo Clean project sucessfully! please do not forget delete all unnecessary file in project folder, For Example: *.txt for batching 2 $chmod +x batch_trac.txt 3 $./batch_trac.txt 4 you can import these code in trac system
-
∞ Generator Backend
$ mkdir classifieds $ cd classifieds $ symfony generate:project classifieds $symfony configure:database "mysql:host=localhost;dbname=classifieds" root mYsEcret $ mysqladmin -uroot -pmYsEcret create classifieds $ symfony propel:build-all-load generate App Backend $symfony generate:app --escaping-strategy=on --csrf-secret=UniqueSecret1 backend generate a module named"conference" for App backend $symfony propel:generate-admin backend DemoAd


