Repository: thecodeholic/Yii2-Youtube-Clone Branch: master Commit: d8d6c35890b5 Files: 237 Total size: 254.7 KB Directory structure: gitextract_etck1_vw/ ├── .bowerrc ├── .gitignore ├── LICENSE.md ├── README.md ├── Vagrantfile ├── backend/ │ ├── Dockerfile │ ├── assets/ │ │ ├── AppAsset.php │ │ └── TagsInputAsset.php │ ├── codeception.yml │ ├── config/ │ │ ├── .gitignore │ │ ├── bootstrap.php │ │ ├── main.php │ │ ├── params.php │ │ └── test.php │ ├── controllers/ │ │ ├── CommentController.php │ │ ├── SiteController.php │ │ └── VideoController.php │ ├── models/ │ │ ├── .gitkeep │ │ └── CommentSearch.php │ ├── runtime/ │ │ └── .gitignore │ ├── tests/ │ │ ├── _bootstrap.php │ │ ├── _data/ │ │ │ ├── .gitignore │ │ │ └── login_data.php │ │ ├── _output/ │ │ │ └── .gitignore │ │ ├── _support/ │ │ │ ├── .gitignore │ │ │ ├── FunctionalTester.php │ │ │ └── UnitTester.php │ │ ├── functional/ │ │ │ ├── LoginCest.php │ │ │ └── _bootstrap.php │ │ ├── functional.suite.yml │ │ ├── unit/ │ │ │ └── _bootstrap.php │ │ └── unit.suite.yml │ ├── views/ │ │ ├── comment/ │ │ │ ├── _comment_item.php │ │ │ ├── _form.php │ │ │ ├── _item.php │ │ │ ├── _search.php │ │ │ ├── create.php │ │ │ ├── index.php │ │ │ ├── update.php │ │ │ └── view.php │ │ ├── layouts/ │ │ │ ├── _header.php │ │ │ ├── _sidebar.php │ │ │ ├── auth.php │ │ │ ├── base.php │ │ │ └── main.php │ │ ├── site/ │ │ │ ├── error.php │ │ │ ├── index.php │ │ │ └── login.php │ │ └── video/ │ │ ├── _form.php │ │ ├── _video_item.php │ │ ├── create.php │ │ ├── index.php │ │ └── update.php │ └── web/ │ ├── app.js │ ├── assets/ │ │ └── .gitignore │ ├── css/ │ │ └── site.css │ └── tagsinput/ │ ├── tagsinput.css │ └── tagsinput.js ├── codeception.yml ├── common/ │ ├── codeception.yml │ ├── config/ │ │ ├── .gitignore │ │ ├── bootstrap.php │ │ ├── main.php │ │ ├── params.php │ │ └── test.php │ ├── fixtures/ │ │ └── UserFixture.php │ ├── helpers/ │ │ └── Html.php │ ├── mail/ │ │ ├── emailVerify-html.php │ │ ├── emailVerify-text.php │ │ ├── layouts/ │ │ │ ├── html.php │ │ │ └── text.php │ │ ├── mention-html.php │ │ ├── mention-text.php │ │ ├── passwordResetToken-html.php │ │ ├── passwordResetToken-text.php │ │ ├── subscriber-html.php │ │ └── subscriber-text.php │ ├── models/ │ │ ├── Comment.php │ │ ├── LoginForm.php │ │ ├── Subscriber.php │ │ ├── User.php │ │ ├── Video.php │ │ ├── VideoLike.php │ │ ├── VideoView.php │ │ └── query/ │ │ ├── CommentQuery.php │ │ ├── SubscriberQuery.php │ │ ├── VideoLikeQuery.php │ │ ├── VideoQuery.php │ │ └── VideoViewQuery.php │ ├── tests/ │ │ ├── _bootstrap.php │ │ ├── _data/ │ │ │ └── user.php │ │ ├── _output/ │ │ │ └── .gitignore │ │ ├── _support/ │ │ │ ├── .gitignore │ │ │ └── UnitTester.php │ │ ├── unit/ │ │ │ └── models/ │ │ │ └── LoginFormTest.php │ │ └── unit.suite.yml │ └── widgets/ │ └── Alert.php ├── composer.json ├── console/ │ ├── config/ │ │ ├── .gitignore │ │ ├── bootstrap.php │ │ ├── main.php │ │ ├── params.php │ │ └── test.php │ ├── controllers/ │ │ └── .gitkeep │ ├── migrations/ │ │ ├── m130524_201442_init.php │ │ ├── m190124_110200_add_verification_token_column_to_user_table.php │ │ ├── m200417_054237_create_videos_table.php │ │ ├── m200418_050048_create_video_view_table.php │ │ ├── m200418_051244_create_video_like_table.php │ │ ├── m200418_060320_create_subscriber_table.php │ │ ├── m200418_064142_create_fulltext_index_on_video.php │ │ ├── m201112_042619_create_comment_table.php │ │ └── m201115_124738_add_mention_column_to_comment_table.php │ ├── models/ │ │ └── .gitkeep │ └── runtime/ │ └── .gitignore ├── docker-compose.yml ├── environments/ │ ├── dev/ │ │ ├── backend/ │ │ │ ├── config/ │ │ │ │ ├── codeception-local.php │ │ │ │ ├── main-local.php │ │ │ │ ├── params-local.php │ │ │ │ └── test-local.php │ │ │ └── web/ │ │ │ ├── index-test.php │ │ │ ├── index.php │ │ │ └── robots.txt │ │ ├── common/ │ │ │ └── config/ │ │ │ ├── codeception-local.php │ │ │ ├── main-local.php │ │ │ ├── params-local.php │ │ │ └── test-local.php │ │ ├── console/ │ │ │ └── config/ │ │ │ ├── main-local.php │ │ │ ├── params-local.php │ │ │ └── test-local.php │ │ ├── frontend/ │ │ │ ├── config/ │ │ │ │ ├── codeception-local.php │ │ │ │ ├── main-local.php │ │ │ │ ├── params-local.php │ │ │ │ └── test-local.php │ │ │ └── web/ │ │ │ ├── index-test.php │ │ │ ├── index.php │ │ │ └── robots.txt │ │ ├── yii │ │ ├── yii_test │ │ └── yii_test.bat │ ├── index.php │ └── prod/ │ ├── backend/ │ │ ├── config/ │ │ │ ├── main-local.php │ │ │ └── params-local.php │ │ └── web/ │ │ ├── index.php │ │ └── robots.txt │ ├── common/ │ │ └── config/ │ │ ├── main-local.php │ │ └── params-local.php │ ├── console/ │ │ └── config/ │ │ ├── main-local.php │ │ └── params-local.php │ ├── frontend/ │ │ ├── config/ │ │ │ ├── main-local.php │ │ │ └── params-local.php │ │ └── web/ │ │ ├── index.php │ │ └── robots.txt │ └── yii ├── frontend/ │ ├── Dockerfile │ ├── assets/ │ │ └── AppAsset.php │ ├── codeception.yml │ ├── config/ │ │ ├── .gitignore │ │ ├── bootstrap.php │ │ ├── main.php │ │ ├── params.php │ │ └── test.php │ ├── controllers/ │ │ ├── ChannelController.php │ │ ├── CommentController.php │ │ ├── SiteController.php │ │ └── VideoController.php │ ├── models/ │ │ ├── PasswordResetRequestForm.php │ │ ├── ResendVerificationEmailForm.php │ │ ├── ResetPasswordForm.php │ │ ├── SignupForm.php │ │ └── VerifyEmailForm.php │ ├── runtime/ │ │ └── .gitignore │ ├── tests/ │ │ ├── _bootstrap.php │ │ ├── _data/ │ │ │ ├── login_data.php │ │ │ └── user.php │ │ ├── _output/ │ │ │ └── .gitignore │ │ ├── _support/ │ │ │ ├── .gitignore │ │ │ ├── FunctionalTester.php │ │ │ └── UnitTester.php │ │ ├── acceptance/ │ │ │ ├── HomeCest.php │ │ │ └── _bootstrap.php │ │ ├── acceptance.suite.yml.example │ │ ├── functional/ │ │ │ ├── AboutCest.php │ │ │ ├── ContactCest.php │ │ │ ├── HomeCest.php │ │ │ ├── LoginCest.php │ │ │ ├── ResendVerificationEmailCest.php │ │ │ ├── SignupCest.php │ │ │ ├── VerifyEmailCest.php │ │ │ └── _bootstrap.php │ │ ├── functional.suite.yml │ │ ├── unit/ │ │ │ ├── _bootstrap.php │ │ │ └── models/ │ │ │ ├── ContactFormTest.php │ │ │ ├── PasswordResetRequestFormTest.php │ │ │ ├── ResendVerificationEmailFormTest.php │ │ │ ├── ResetPasswordFormTest.php │ │ │ ├── SignupFormTest.php │ │ │ └── VerifyEmailFormTest.php │ │ └── unit.suite.yml │ ├── views/ │ │ ├── channel/ │ │ │ ├── _subscribe.php │ │ │ └── view.php │ │ ├── layouts/ │ │ │ ├── _header.php │ │ │ ├── _sidebar.php │ │ │ ├── auth.php │ │ │ ├── base.php │ │ │ └── main.php │ │ ├── site/ │ │ │ ├── error.php │ │ │ ├── index.php │ │ │ ├── login.php │ │ │ ├── requestPasswordResetToken.php │ │ │ ├── resendVerificationEmail.php │ │ │ ├── resetPassword.php │ │ │ └── signup.php │ │ └── video/ │ │ ├── _buttons.php │ │ ├── _comment_item.php │ │ ├── _video_item.php │ │ ├── history.php │ │ ├── index.php │ │ ├── search.php │ │ └── view.php │ └── web/ │ ├── assets/ │ │ └── .gitignore │ ├── css/ │ │ └── site.css │ ├── js/ │ │ └── app.js │ └── storage/ │ └── .gitignore ├── init ├── init.bat ├── requirements.php ├── sample.php ├── vagrant/ │ ├── config/ │ │ ├── .gitignore │ │ └── vagrant-local.example.yml │ ├── nginx/ │ │ ├── app.conf │ │ └── log/ │ │ └── .gitignore │ └── provision/ │ ├── always-as-root.sh │ ├── common.sh │ ├── once-as-root.sh │ └── once-as-vagrant.sh └── yii.bat ================================================ FILE CONTENTS ================================================ ================================================ FILE: .bowerrc ================================================ { "directory" : "vendor/bower-asset" } ================================================ FILE: .gitignore ================================================ # yii console commands /yii /yii_test /yii_test.bat # phpstorm project files .idea # netbeans project files nbproject # zend studio for eclipse project files .buildpath .project .settings # windows thumbnail cache Thumbs.db # composer vendor dir /vendor # composer itself is not needed composer.phar # Mac DS_Store Files .DS_Store # phpunit itself is not needed phpunit.phar # local phpunit config /phpunit.xml # vagrant runtime /.vagrant # ignore generated files /frontend/web/index.php /frontend/web/index-test.php /frontend/web/robots.txt /backend/web/index.php /backend/web/index-test.php /backend/web/robots.txt ================================================ FILE: LICENSE.md ================================================ Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Yii Software LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: README.md ================================================
= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> = Html::a('Delete', ['delete', 'id' => $model->id], [ 'class' => 'btn btn-danger', 'data' => [ 'confirm' => 'Are you sure you want to delete this item?', 'method' => 'post', ], ]) ?>
= DetailView::widget([ 'model' => $model, 'attributes' => [ 'id', 'comment:ntext', 'video_id', 'parent_id', 'pinned', 'created_at', 'updated_at', 'created_by', ], ]) ?>The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
Please fill out the following fields to login:
Drag and drop a file you want to upload
Your video will be private until you publish it
['enctype' => 'multipart/form-data'] ]) ?> errorSummary($model) ?>= Html::a('Create Video', ['create'], ['class' => 'btn btn-success']) ?>
= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], [ 'attribute' => 'title', 'content' => function ($model) { return $this->render('_video_item', ['model' => $model]); } ], [ 'attribute' => 'status', 'content' => function ($model) { return $model->getStatusLabels()[$model->status]; } ], //'has_thumbnail', //'video_name', 'created_at:datetime', 'updated_at:datetime', //'created_by', [ 'class' => 'yii\grid\ActionColumn', 'buttons' => [ 'delete' => function ($url) { return Html::a('Delete', $url, [ 'data-method' => 'post', 'data-confirm' => 'Are you sure?' ]); } ] ], ], ]); ?>Hello = Html::encode($user->username) ?>,
Follow the link below to verify your email:
= Html::a(Html::encode($verifyLink), $verifyLink) ?>
Hello username ?>
User has mention you in the following comment
FreeCodeTube team
================================================ FILE: common/mail/mention-text.php ================================================ Hello username ?> User has mention you in the following comment FreeCodeTube team ================================================ FILE: common/mail/passwordResetToken-html.php ================================================ urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); ?>Hello = Html::encode($user->username) ?>,
Follow the link below to reset your password:
= Html::a(Html::encode($resetLink), $resetLink) ?>
Hello username ?>
User has subscribed to you
FreeCodeTube team
================================================ FILE: common/mail/subscriber-text.php ================================================ Hello username ?> User username ?> has subscribed to you FreeCodeTube team ================================================ FILE: common/models/Comment.php ================================================ BlameableBehavior::class, 'updatedByAttribute' => false ] ]; } /** * {@inheritdoc} */ public function rules() { return [ [['comment', 'video_id'], 'required'], [['comment'], 'string'], [['parent_id', 'pinned', 'created_at', 'updated_at', 'created_by'], 'integer'], [['video_id'], 'string', 'max' => 16], [['mention'], 'string', 'max' => 255], [['created_by'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['created_by' => 'id']], [['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Comment::className(), 'targetAttribute' => ['parent_id' => 'id']], [['video_id'], 'exist', 'skipOnError' => true, 'targetClass' => Video::className(), 'targetAttribute' => ['video_id' => 'video_id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'comment' => 'Comment', 'video_id' => 'Video ID', 'parent_id' => 'Parent ID', 'pinned' => 'Pinned', 'mention' => 'Mention', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'created_by' => 'Created By', ]; } /** * Gets query for [[CreatedBy]]. * * @return \yii\db\ActiveQuery|\common\models\query\UserQuery */ public function getCreatedBy() { return $this->hasOne(User::className(), ['id' => 'created_by']); } /** * Gets query for [[Parent]]. * * @return \yii\db\ActiveQuery|\common\models\query\CommentQuery */ public function getParent() { return $this->hasOne(Comment::className(), ['id' => 'parent_id']); } /** * Gets query for [[Comments]]. * * @return \yii\db\ActiveQuery|\common\models\query\CommentQuery */ public function getComments() { return $this->hasMany(Comment::className(), ['parent_id' => 'id']); } /** * Gets query for [[Video]]. * * @return \yii\db\ActiveQuery|\common\models\query\VideoQuery */ public function getVideo() { return $this->hasOne(Video::className(), ['video_id' => 'video_id']); } /** * {@inheritdoc} * @return \common\models\query\CommentQuery the active query used by this AR class. */ public static function find() { return new \common\models\query\CommentQuery(get_called_class()); } public function belongsTo($userId) { return $this->created_by === $userId; } } ================================================ FILE: common/models/LoginForm.php ================================================ hasErrors()) { $user = $this->getUser(); if (!$user || !$user->validatePassword($this->password)) { $this->addError($attribute, 'Incorrect username or password.'); } } } /** * Logs in a user using the provided username and password. * * @return bool whether the user is logged in successfully */ public function login() { if ($this->validate()) { return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); } return false; } /** * Finds user by [[username]] * * @return User|null */ protected function getUser() { if ($this->_user === null) { $this->_user = User::findByUsername($this->username); } return $this->_user; } } ================================================ FILE: common/models/Subscriber.php ================================================ true, 'targetClass' => User::className(), 'targetAttribute' => ['channel_id' => 'id']], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'channel_id' => 'Channel ID', 'user_id' => 'User ID', 'created_at' => 'Created At', ]; } /** * Gets query for [[Channel]]. * * @return \yii\db\ActiveQuery|\common\models\query\UserQuery */ public function getChannel() { return $this->hasOne(User::className(), ['id' => 'channel_id']); } /** * Gets query for [[User]]. * * @return \yii\db\ActiveQuery|\common\models\query\UserQuery */ public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); } /** * {@inheritdoc} * @return \common\models\query\SubscriberQuery the active query used by this AR class. */ public static function find() { return new \common\models\query\SubscriberQuery(get_called_class()); } } ================================================ FILE: common/models/User.php ================================================ self::STATUS_INACTIVE], ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_INACTIVE, self::STATUS_DELETED]], ]; } /** * @return \yii\db\ActiveQuery * @throws \yii\base\InvalidConfigException * @author Zura SekhniashviliThe above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Please fill out the following fields to login:
Please fill out your email. A link to reset password will be sent there.
Please fill out your email. A verification email will be sent there.
Please choose your new password:
Please fill out the following fields to signup:
createdBy) ?>
getViews()->count() ?> views . formatter->asRelativeTime($model->created_at) ?>
createdBy) ?>
description) ?>The path to yii framework seems to be incorrect.
\n" . 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".
\n" . 'Please refer to the README on how to install Yii.
\n"; if (!empty($_SERVER['argv'])) { // do not print HTML when used in console mode echo strip_tags($message); } else { echo $message; } exit(1); } require_once $frameworkPath . '/requirements/YiiRequirementChecker.php'; $requirementsChecker = new YiiRequirementChecker(); $gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; $gdOK = $imagickOK = false; if (extension_loaded('imagick')) { $imagick = new Imagick(); $imagickFormats = $imagick->queryFormats('PNG'); if (in_array('PNG', $imagickFormats)) { $imagickOK = true; } else { $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.'; } } if (extension_loaded('gd')) { $gdInfo = gd_info(); if (!empty($gdInfo['FreeType Support'])) { $gdOK = true; } else { $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.'; } } /** * Adjust requirements according to your application specifics. */ $requirements = array( // Database : array( 'name' => 'PDO extension', 'mandatory' => true, 'condition' => extension_loaded('pdo'), 'by' => 'All DB-related classes', ), array( 'name' => 'PDO SQLite extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_sqlite'), 'by' => 'All DB-related classes', 'memo' => 'Required for SQLite database.', ), array( 'name' => 'PDO MySQL extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_mysql'), 'by' => 'All DB-related classes', 'memo' => 'Required for MySQL database.', ), array( 'name' => 'PDO PostgreSQL extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_pgsql'), 'by' => 'All DB-related classes', 'memo' => 'Required for PostgreSQL database.', ), // Cache : array( 'name' => 'Memcache extension', 'mandatory' => false, 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), 'by' => 'MemCache', 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached totrue.' : ''
),
array(
'name' => 'APC extension',
'mandatory' => false,
'condition' => extension_loaded('apc'),
'by' => 'ApcCache',
),
// CAPTCHA:
array(
'name' => 'GD PHP extension with FreeType support',
'mandatory' => false,
'condition' => $gdOK,
'by' => 'Captcha',
'memo' => $gdMemo,
),
array(
'name' => 'ImageMagick PHP extension with PNG support',
'mandatory' => false,
'condition' => $imagickOK,
'by' => 'Captcha',
'memo' => $imagickMemo,
),
// PHP ini :
'phpExposePhp' => array(
'name' => 'Expose PHP',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
'by' => 'Security reasons',
'memo' => '"expose_php" should be disabled at php.ini',
),
'phpAllowUrlInclude' => array(
'name' => 'PHP allow url include',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
'by' => 'Security reasons',
'memo' => '"allow_url_include" should be disabled at php.ini',
),
'phpSmtp' => array(
'name' => 'PHP mail SMTP',
'mandatory' => false,
'condition' => strlen(ini_get('SMTP')) > 0,
'by' => 'Email sending',
'memo' => 'PHP mail SMTP server required',
),
);
$result = $requirementsChecker->checkYii()->check($requirements)->getResult();
$requirementsChecker->render();
exit($result['summary']['errors'] === 0 ? 0 : 1);
================================================
FILE: sample.php
================================================
# Read more: https://github.com/blog/1509-personal-api-tokens
# You can generate it here: https://github.com/settings/tokens
# Guest OS timezone
timezone: Europe/London
# Are we need check box updates for every 'vagrant up'?
box_check_update: false
# Virtual machine name
machine_name: y2aa
# Virtual machine IP
ip: 192.168.83.137
# Virtual machine CPU cores number
cpus: 1
# Virtual machine RAM
memory: 1024
================================================
FILE: vagrant/nginx/app.conf
================================================
server {
charset utf-8;
client_max_body_size 128M;
sendfile off;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name y2aa-frontend.test;
root /app/frontend/web/;
index index.php;
access_log /app/vagrant/nginx/log/frontend-access.log;
error_log /app/vagrant/nginx/log/frontend-error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
server {
charset utf-8;
client_max_body_size 128M;
sendfile off;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name y2aa-backend.test;
root /app/backend/web/;
index index.php;
access_log /app/vagrant/nginx/log/backend-access.log;
error_log /app/vagrant/nginx/log/backend-error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
================================================
FILE: vagrant/nginx/log/.gitignore
================================================
# nginx logs
backend-access.log
backend-error.log
frontend-access.log
frontend-error.log
================================================
FILE: vagrant/provision/always-as-root.sh
================================================
#!/usr/bin/env bash
source /app/vagrant/provision/common.sh
#== Provision script ==
info "Provision-script user: `whoami`"
info "Restart web-stack"
service php7.0-fpm restart
service nginx restart
service mysql restart
================================================
FILE: vagrant/provision/common.sh
================================================
#!/usr/bin/env bash
#== Bash helpers ==
function info {
echo " "
echo "--> $1"
echo " "
}
================================================
FILE: vagrant/provision/once-as-root.sh
================================================
#!/usr/bin/env bash
source /app/vagrant/provision/common.sh
#== Import script args ==
timezone=$(echo "$1")
#== Provision script ==
info "Provision-script user: `whoami`"
export DEBIAN_FRONTEND=noninteractive
info "Configure timezone"
timedatectl set-timezone ${timezone} --no-ask-password
info "Prepare root password for MySQL"
debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password \"''\""
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password \"''\""
echo "Done!"
info "Update OS software"
apt-get update
apt-get upgrade -y
info "Install additional software"
apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mysql-server-5.7 php.xdebug
info "Configure MySQL"
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
mysql -uroot <<< "CREATE USER 'root'@'%' IDENTIFIED BY ''"
mysql -uroot <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'"
mysql -uroot <<< "DROP USER 'root'@'localhost'"
mysql -uroot <<< "FLUSH PRIVILEGES"
echo "Done!"
info "Configure PHP-FPM"
sed -i 's/user = www-data/user = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
sed -i 's/group = www-data/group = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
sed -i 's/owner = www-data/owner = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
cat << EOF > /etc/php/7.0/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_autostart=1
EOF
echo "Done!"
info "Configure NGINX"
sed -i 's/user www-data/user vagrant/g' /etc/nginx/nginx.conf
echo "Done!"
info "Enabling site configuration"
ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf
echo "Done!"
info "Initailize databases for MySQL"
mysql -uroot <<< "CREATE DATABASE yii2advanced"
mysql -uroot <<< "CREATE DATABASE yii2advanced_test"
echo "Done!"
info "Install composer"
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
================================================
FILE: vagrant/provision/once-as-vagrant.sh
================================================
#!/usr/bin/env bash
source /app/vagrant/provision/common.sh
#== Import script args ==
github_token=$(echo "$1")
#== Provision script ==
info "Provision-script user: `whoami`"
info "Configure composer"
composer config --global github-oauth.github.com ${github_token}
echo "Done!"
info "Install project dependencies"
cd /app
composer --no-progress --prefer-dist install
info "Init project"
./init --env=Development --overwrite=y
info "Apply migrations"
./yii migrate --interactive=0
./yii_test migrate --interactive=0
info "Create bash-alias 'app' for vagrant user"
echo 'alias app="cd /app"' | tee /home/vagrant/.bash_aliases
info "Enabling colorized prompt for guest console"
sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" /home/vagrant/.bashrc
================================================
FILE: yii.bat
================================================
@echo off
rem -------------------------------------------------------------
rem Yii command line bootstrap script for Windows.
rem -------------------------------------------------------------
@setlocal
set YII_PATH=%~dp0
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
"%PHP_COMMAND%" "%YII_PATH%yii" %*
@endlocal
createdBy) ?> formatter->asRelativeTime($model->created_at) ?> created_at !== $model->updated_at): ?> (edited)