You are supposed to have this project layout:
node_modules/
bower_components/
coffee/
jade/
scss/
svg/
<?php | |
/** | |
* Valida CPF | |
* | |
* @author Luiz Otávio Miranda <[email protected]/w> | |
* @param string $cpf O CPF com ou sem pontos e traço | |
* @return bool True para CPF correto - False para CPF incorreto | |
* | |
*/ |
$_SERVER['HTTP_HOST'] = '127.0.0.1'; | |
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
define('DRUPAL_ROOT', getcwd().'/www'); | |
chdir(DRUPAL_ROOT); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
require_once DRUPAL_ROOT . '/includes/database/database.inc'; | |
require_once DRUPAL_ROOT . '/includes/cache.inc'; | |
require_once DRUPAL_ROOT . '/includes/file.inc'; | |
require_once DRUPAL_ROOT . '/includes/module.inc'; | |
require_once DRUPAL_ROOT . '/includes/registry.inc'; |
<?php | |
use Drupal\node\Entity\Node; | |
$current_language = \Drupal::languageManager()->getCurrentLanguage(); | |
$default_pages = \Drupal::state()->get('my_module.default_pages', array()); | |
$node_id = (isset($default_pages['front_' . $current_language->getId()]) ? $default_pages['front_' . $current_language->getId()] : NULL); | |
if (!$node_id) { | |
return NULL; | |
} |
<?php | |
/** | |
* @file | |
* Drupal install speed. | |
*/ | |
/** | |
* Yes, this is important. | |
*/ | |
set_time_limit(0); |
<?php | |
// thx drupal8.ovh | |
//// 1) How to get the current language in Drupal 8 | |
//To get the lanuage code: | |
$language = \Drupal::languageManager()->getCurrentLanguage()->getId(); | |
//To get the language name: | |
$language = \Drupal::languageManager()->getCurrentLanguage()->getName(); |
[ | |
{ | |
"keys": ["ctrl+w"], | |
"command": "run_multiple", | |
"args": { | |
"commands": [ | |
{"command": "find_under_expand", "args": null, "context": "window"}, | |
{"command": "show_panel", "args": {"panel": "find"}, "context": "window"} | |
] | |
} |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
<?php | |
define('DRUPAL_ROOT', getcwd()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
require_once DRUPAL_ROOT . '/includes/password.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
db_query('UPDATE {users} SET pass = :hash WHERE uid = 1', | |
array(':hash' => user_hash_password('PASSWORD_HERE')) | |
); |