Skip to content

Instantly share code, notes, and snippets.

@stojg
Created August 14, 2012 22:16
Show Gist options
  • Save stojg/3353496 to your computer and use it in GitHub Desktop.
Save stojg/3353496 to your computer and use it in GitHub Desktop.
Search and replace for SS 3.0 upgrade [beta]
function replace {
echo Replacing '"'$1'"' with '"'$2'"'
find . \( -path './framework' -o -path './cms' -o -path './.git' \) -prune -o -name '*.php' -exec grep -l "$1" {} \; | xargs sed -i "" 's/'"$1"'/'"$2"'/g'
}
replace 'Director::currentPage(' 'Director::get_current_page('
replace 'Member::currentMember(' 'Member::currentUser('
replace 'new DataObjectSet' 'new ArrayList'
replace 'new FieldSet' 'new FieldList'
replace 'DBField::create(' 'DBField::create_field('
replace 'Director::URLParam(' 'Controller::curr()->getRequest()->param('
replace 'Director::urlParam(' 'Controller::curr()->getRequest()->param('
replace 'Database::alteration_message(' 'DB::alteration_message('
replace 'Director::isSSL()' "(Director::protocol()==='https:\/\/')"
replace 'extends SSReport' 'extends SS_Report'
replace 'function getFrontEndFields()' 'function getFrontEndFields($params = null)'
replace 'function updateCMSFields(&$fields)' 'function updateCMSFields($fields)'
replace 'function Breadcrumbs()' 'function Breadcrumbs($maxDepth = 20, $unlinked = false, $stopAtPageType = false, $showHidden = false)'
replace 'extends DataObjectDecorator' 'extends DataExtension'
replace 'extends SiteTreeDecorator' 'extends SiteTreeExtension'
replace 'function extraStatics()' 'function extraStatics($class = null, $extension = null)'
replace 'function updateCMSFields($fields)' 'function updateCMSFields(FieldList $fields)'
replace 'function updateCMSFields(&$fields)' 'function updateCMSFields(FieldList $fields)'
replace 'function updateCMSFields(FieldSet &$fields)' 'function updateCMSFields(FieldList $fields)'
replace 'function canEdit()' 'function canEdit($member = null)'
replace 'function canView()' 'function canView($member = null)'
replace 'function canCreate()' 'function canCreate($member = null)'
replace 'function canDelete()' 'function canDelete($member = null)'
replace 'function Field()' 'function Field($properties = array())'
replace 'function sendPlain()' 'function sendPlain($messageID = null)'
replace 'function send()' 'function send($messageID = null)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment