craftcms / docs

Documentation for Craft CMS, Craft Commerce, and other official products.
https://craftcms.com/docs
39 stars 150 forks source link

Getting phpdotenv also into Craft 2 -> Craft 3 upgrades, plus hopeful adds #11

Closed narration-sd closed 2 years ago

narration-sd commented 7 years ago

Doc is missing in the section for these conversions,, but it's easy to provide, thus allowing all Craft 3 sites to take advantage of the better security possible, and be consistent when addressed in future.

Think what would be useful in the initial Updating Craft CMS section of upgrade.md is:

<?php

// Project root path
$root = dirname(__DIR__);

// Load and run Craft
define('CRAFT_BASE_PATH', $root.'/craft');
require_once $root.'/vendor/autoload.php';

// dotenv?
if (file_exists($root.'/.env')
  && file_exists($root.'/vendor/vlucas/phpdotenv')) {
    $dotenv = new Dotenv\Dotenv($root);
    $dotenv->load();
}

$app = require $root.'/vendor/craftcms/cms/bootstrap/web.php';
$app->run();
narration-sd commented 7 years ago

Added note: it's likely quite useful to add to primary doc how the file and url paths need to be set, especially with regard to Sites -- or even primary Site.

Points to be expressed -- I know we've hit some of these before, but to draw together:

Ok, notes at least on a Sunday morning -- definitely can use careful editing and otherwise knocking into shape for doc...cases, though, taken from experiences, and the time taken to sort them out...

AugustMiller commented 2 years ago

I've decided to close this, in part because the Craft 2.x and 3.x docs have been frozen (aside from the occasional backwards-compatible edit), and in part because I found a spot to make mention of the primary asks (regarding phpdotenv and entry scripts) in the 3.x -> 4.x upgrade guide.

If you would like to submit the remainder of the requests individually, please do! This is all is a work-in-progress—and we’re aware of a few places where Assets are underserved by the documentation.