Skip to content

Instantly share code, notes, and snippets.

@Fi1osof Fi1osof/update_urls.php Secret
Last active Aug 1, 2016

Embed
What would you like to do?
Перенос с Эво на Рево
TRUNCATE `modx_site_content`;
INSERT INTO `modx_site_content`
(`id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `content`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu` )
select `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `content`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`
from `old`.`modx_site_content`;
update `modx_site_content`
set class_key = 'modWebLink'
where type = 'reference';
TRUNCATE `modx_site_templates`;
INSERT INTO `modx_site_templates`
(`id`, `templatename`, `description`, `editor_type`, `icon`, `template_type`, `content`, `locked` )
select
`id`, `templatename`, `description`, `editor_type`, `icon`, `template_type`, `content`, `locked`
from `old`.`modx_site_templates`;
TRUNCATE `modx_site_tmplvars`;
INSERT INTO `modx_site_tmplvars`
(`id`, `type`, `name`, `caption`, `description`, `editor_type`, `locked`, `elements`, `rank`, `display`, `default_text`)
select
`id`, `type`, `name`, `caption`, `description`, `editor_type`, `locked`, `elements`, `rank`, `display`, `default_text`
from `old`.`modx_site_tmplvars`;
TRUNCATE `modx_site_tmplvar_contentvalues`;
INSERT INTO `modx_site_tmplvar_contentvalues`
SELECT *
FROM `old`.`modx_site_tmplvar_contentvalues`;
TRUNCATE `modx_site_tmplvar_templates`;
INSERT INTO `modx_site_tmplvar_templates`
SELECT *
FROM `old`.`modx_site_tmplvar_templates`;
<?php
$urls = array (
);
foreach($urls as $id => $uri){
if($doc = $modx->getObject("modResource", $id)){
$doc->fromArray(array(
"uri" => $uri,
"uri_override" => 1,
));
$doc->save();
}
// break;
}
print '<pre>';
// print_r($modx->documentMap);
// print $modx->makeUrl(1617);
$urls = array();
foreach($modx->documentMap as $a){
$id = current($a);
if($id == 1) continue;
$urls[$id] = preg_replace('/^\/+/', '', $modx->makeUrl($id));
// break;
}
var_export($urls);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.