urlRewrite.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. Cur_Dir=$(cd `dirname $0`; pwd)
  3. # init full search collection indexes.
  4. $Cur_Dir/../../../../yii product/search/initindex
  5. # get now update timestamp.
  6. nowtime=`$Cur_Dir/../../../../yii helper/urlrewrite/nowtime`
  7. # 1.Product 遍历所有产品,把product的url_key 写入到url rewrite
  8. # get product all count.
  9. count=`$Cur_Dir/../../../../yii helper/urlrewrite/productcount`
  10. pagenum=`$Cur_Dir/../../../../yii helper/urlrewrite/productpagenum`
  11. echo "There are $count products to process"
  12. echo "There are $pagenum products pages to process"
  13. echo "##############ALL BEGINING###############";
  14. for (( i=1; i<=$pagenum; i++ ))
  15. do
  16. $Cur_Dir/../../../../yii helper/urlrewrite/product $i
  17. echo "Page $i done"
  18. done
  19. # 2.Category 遍历所有的分类,把category的url_key 写入到 url rewrite
  20. count=`$Cur_Dir/../../../../yii helper/urlrewrite/categorycount`
  21. pagenum=`$Cur_Dir/../../../../yii helper/urlrewrite/categorypagenum`
  22. echo "There are $count categorys to process"
  23. echo "There are $pagenum categorys pages to process"
  24. echo "##############ALL BEGINING###############";
  25. for (( i=1; i<=$pagenum; i++ ))
  26. do
  27. $Cur_Dir/../../../../yii helper/urlrewrite/category $i
  28. echo "Page $i done"
  29. done
  30. # delete all search data that sync_updated_at $gt $nowtime.
  31. # $Cur_Dir/../../../../yii helper/urlrewrite/clearnoactive $nowtime
  32. ###### 1.Sync Section End
  33. echo "##############ALL COMPLETE###############";