hard coded links when switching to ssl moodle

hard coded links when switching to ssl moodle

by Albert Ramsbottom -
Number of replies: 10

Moodle 2.9

Just been through a large upgrade from 1.9 to 2.9 and was wondering what people do to deal with hardcoded links in content after switching to full https across the site

Should I include an apache rewrite? or just get the users to chnage all there links?

or any other advice on this one?

Cheers


Albert

Average of ratings: -
In reply to Albert Ramsbottom

Re: hard coded links when switching to ssl moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just use Moodle's built in replace admin tool.

In reply to Howard Miller

Re: hard coded links when switching to ssl moodle

by Albert Ramsbottom -

Sorry but hardcoded links in HTML are not replaced by noodles DB search and replace or am I missing a tool.  Is there a CLI version.

I did try one but I kept getting an error that the new URL was longer than the previous one??


Cheers

Albert

In reply to Albert Ramsbottom

Re: hard coded links when switching to ssl moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The replace.php tool in here somewhere... Administration_via_command_line

They will be replaced if you include the http/https bit. Obviously, give it enough of the rest to make it work properly.

In reply to Howard Miller

Re: hard coded links when switching to ssl moodle

by Albert Ramsbottom -

Hi

I did try one but I kept getting an error that the new URL was longer than the previous one??

I think this is a bug


The replacement is longer than original and shortening is not allow, cannot continue.

Dont worry ill have to sed the DB, but that is a bug above
In reply to Albert Ramsbottom

Re: hard coded links when switching to ssl moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Options:
--search=STRING       String to search for.
--replace=STRING      String to replace with.
--shorten             Shorten result if necessary.
--non-interactive     Perform the replacement without confirming.
-h, --help            Print out this help.


Try '--shorten'. Just sayin' wink

Average of ratings: Useful (2)
In reply to Howard Miller

Re: hard coded links when switching to ssl moodle

by Albert Ramsbottom -

Ill give that ago, thanks Howard but I was wondering where the documentation on those options are kept

They dont seem to be on the wiki


Cheers

In reply to Albert Ramsbottom

Re: hard coded links when switching to ssl moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

it's the help option on the tool itself. 

In reply to Albert Ramsbottom

Re: hard coded links when switching to ssl moodle

by Ken Task -
Picture of Particularly helpful Moodlers

In a 3.1 code directory:
Directories that contain a 'cli' subdir.   There could be more than one script in
a cli directory.

./admin/cli
./admin/tool/behat/cli
./admin/tool/dbtransfer/cli
./admin/tool/generator/cli
./admin/tool/phpunit/cli
./admin/tool/replace/cli
./admin/tool/task/cli
./admin/tool/uploadcourse/cli
./auth/cas/cli
./auth/db/cli
./auth/ldap/cli
./enrol/category/cli
./enrol/cohort/cli
./enrol/database/cli
./enrol/flatfile/cli
./enrol/ldap/cli
./enrol/manual/cli
./enrol/meta/cli
./enrol/paypal/cli
./enrol/self/cli
./lib/editor/tinymce/cli
./search/cli
./theme/base/cli

Those that have a --help (-h) option which brings up a help screen showing
how to execute the command. php /[dir]/cli/[scriptname].php -h

./admin/cli/alternative_component_cache.php:    $help =
./admin/cli/automated_backups.php:    $help =
./admin/cli/backup.php:    $help = <<<EOL
./admin/cli/check_database_schema.php:$help = "Validate database structure
./admin/cli/cron.php:    $help =
./admin/cli/fix_course_sequence.php:    $help =
./admin/cli/fix_deleted_users.php:    $help =
./admin/cli/fix_orphaned_question_categories.php:    $help =
./admin/cli/install.php:$help =
./admin/cli/install_database.php:$help =
./admin/cli/maintenance.php:    $help =
./admin/cli/mysql_collation.php:$help =
./admin/cli/mysql_compressed_rows.php:$help =
./admin/cli/mysql_engine.php:$help =
./admin/cli/purge_caches.php:    $help =
./admin/cli/reset_password.php:    $help =
./admin/cli/upgrade.php:    $help =
./search/cli/indexer.php:    $help =

NOTE: my fgreping skills not all that great.   There might be some missing from list.

'spirit of sharing', Ken

Average of ratings: Useful (1)