25 if (!defined(
'NOSESSION')) define(
'NOSESSION',
'1');
27 $sapi_type = php_sapi_name();
28 $script_file = basename(__FILE__);
32 if (substr($sapi_type, 0, 3) ==
'cgi') {
33 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
38 define(
'EVEN_IF_ONLY_LOGIN_ALLOWED', 1);
42 $mode = empty($argv[1]) ?
'' : $argv[1];
43 $websiteref = empty($argv[2]) ?
'' : $argv[2];
44 $max = (!isset($argv[3]) || (empty($argv[3]) && $argv[3] !==
'0')) ?
'10' : $argv[3];
46 if (empty($argv[2]) || !in_array($argv[1], array(
'test',
'confirm')) || empty($websiteref)) {
47 print '***** '.$script_file.
' *****'.
"\n";
48 print "Usage: $script_file (test|confirm) website [nbmaxrecord]\n";
50 print "Regenerate all pages of a web site.\n";
54 require $path.
"../../htdocs/master.inc.php";
55 include_once DOL_DOCUMENT_ROOT.
'/website/class/website.class.php';
56 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
57 include_once DOL_DOCUMENT_ROOT.
'/core/lib/website2.lib.php';
62 $result = $website->fetch(0, $websiteref);
64 print 'Error, web site '.$websiteref.
' not found'.
"\n";
72 $listofpages = $websitepagestatic->fetchAll($website->id,
'',
'', $max);
74 global $dolibarr_main_data_root;
75 $pathofwebsite = $dolibarr_main_data_root.
'/website/'.$websiteref;
78 foreach ($listofpages as $websitepage) {
79 $filealias = $pathofwebsite.
'/'.$websitepage->pageurl.
'.php';
80 $filetpl = $pathofwebsite.
'/page'.$websitepage->id.
'.tpl.php';
81 if ($mode ==
'confirm') {
85 print "Generation of page done - pageid = ".$websitepage->id.
" - ".$websitepage->pageurl.
"\n";
88 if ($max && $nbgenerated >= $max) {
89 print 'Nb max of record ('.$max.
') reached. We stop now.'.
"\n";
94 if ($mode ==
'confirm') {
95 print $nbgenerated.
" page(s) generated into ".$pathofwebsite.
"\n";
97 print $nbgenerated.
" page(s) found but not generated (test mode)\n";
dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
Save content of a page on disk (page name is generally ID_of_page.php).
dolSavePageAlias($filealias, $object, $objectpage)
Save an alias page on disk (A page that include the reference page).
print
Draft customers invoices.