Yii RBAC issue in putty - php

In the slides im reading for creating user auth i have to install rbaccommand.php in the protect/commands/shell folder.
My Rbac is the one found here http://pastebin.com/uENRQ5Nz
i have this in my config/main.php
'authManager'=>array(
'class' => 'CDbAuthManager',
'connectionID' => 'db',
),
and this is the line i put into the command line. php yiic.php shell config/main.php i'm supposed to type yes afterwards but it states rbac isn't found.
Am i missing a step?
Sam

Related

Symfony doctrine error "DoctrineMigrationsBundle requires DoctrineBundle to be enabled."

I have created a fresh Symfony project and I keep getting this "DoctrineMigrationsBundle requires DoctrineBundle to be enabled." error and cant get rid of it. Apparently I'm the only one on the planet who gets this error as google wasn't too helpful.
in the config/bundles.php file I have the following which should "Enable" DoctrineBundle but I'm missing something and cant tell what it is.
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
];
I had the same error,
for some reason, the yaml files that should be inside config/packages were not committed to git.
You can do the following:
create a new symfony project
copy the config/packages folder from the fresh install to my project
copy the /bin folder as well if it is also missing
add these 2 line to .gitignore
!/bin/
!/config/packages/*
(Adding the !/bin to .gitignore is not related to this error, but it should not be ignored anymore as of symfony 6 and is the solution to fix this other error: Script cache:clear returned with error code 1
Could not open input file: ./bin/console). when you install a symfony project from git.

spatie/laravel-backup "mysqldump" doesn't recognized when I run it through Artisan class

I'm using spatie/laravel-backup in a WAMP localhost.
It works fine when I type manually in the windows cmd:
php artisan backup:run
But when I try to run the backup using the laravel Artisan class:
Artisan::call('backup:run');
It throw an error:
'mysqldump' not recognized ...
In the laravel mysql config I've also specified the path to the dumper:
'mysql' => [
'driver' => 'mysql',
// ...
'dump' => [
'dump_binary_path' => 'E:/wamp/wamp64/bin/mysql/mysql5.7.9/bin',
],
],
How can i fix that?
EDIT
Probably it's just support "bug" for windows (finded out thanks Loek's answer), as the author says, so can I run a backup in a controller without a command safely? maybe with something like:
use Spatie\Backup\Tasks\Backup\BackupJobFactory;
BackupJobFactory::createFromArray(config('laravel-backup'))->run();
As the command itself.
I believe it's the forward slashes. Try this:
'mysql' => [
'driver' => 'mysql',
// ...
'dump' => [
'dump_binary_path' => 'E:\\wamp\\wamp64\\bin\\mysql\\mysql5.7.9\\bin',
],
],
EDIT
Support for Windows is wonky at best, with multiple "This package doesn't support Windows" comments from the creators on GitHub issues. This one is the latest: https://github.com/spatie/laravel-backup/issues/311
It could also be a permission problem. Executing from the command line is probably happening from another user than executing from the web server, so Windows is denying access to mysqldump.
2nd edit
As long as you make sure the controller only gets called when it needs to be, I don't see why this wouldn't work!

How to manually install chat module in Humhub

I just installed humhub and downloaded the chat module from github. https://github.com/ychoucha/HUMHUB-module-chat
I gitcloned it to humhub/protected/modules. But, it does not show up in the modules section of administration login. How do I install this or other third part modules in Humhub?
According to this link https://github.com/humhub/humhub/issues/165 on Sep 12, 2014, Luke said:
You can also install modules manually:
Download Module (e.g. mail)
Put it into protected/modules/mail
Enable it in Administration -> Modules
I've tried with the Tasks modules and it worked. Make sure you have the latest stable version of the code from the Humhub repository. You also must be able to download that directly from the Administration > Modules > Find Online
The module no longer works since humhub v1.0.
According to the docs you need to add a config.php file.
https://www.humhub.org/docs/guide-dev-module.html
config.php (replaces autostart.php)
<?php
use humhub\modules\dashboard\widgets\Sidebar;
return [
'id' => 'chat',
'class' => 'humhub\modules\chat\ChatModule',
'namespace' => 'humhub\modules\chat',
'events' => [
array(
'class' => Sidebar::className(),
'event' => Sidebar::EVENT_INIT,
'callback' => array(
'humhub\modules\chat\ChatModule',
'onSidebarInit'
)
),
],
];

php - ./yiic rresque start does nothing

I installed this extension http://www.yiiframework.com/extension/yii-resque/
user#host:/path/to/protected$ ./yiic rresque start
Yii command runner (based on Yii v1.1.13)
Usage: ./yiic <command-name> [parameters...]
The following commands are available:
- message
- migrate
- shell
- webapp
To see individual command help, use the following:
./yiic help <command-name>
What's might be wrong?
EDIT
I figured out the problem: I didn't put RResqueCommand.php into ./protected/commands folder.
Put RResqueCommand.php inside protected/commands
According the yii docs:
Console commands are stored as class files under the directory specified by CConsoleApplication::commandPath.
By default, this refers to the directory protected/commands.
Put this into your config/console.php:
'import' => array(
'application.models.*',
'application.components.*',
),

Installation of a symfony2 bundle (DoctrineCouchDBBundle)

I wish to install the bundle into my symfony project. However, I am coming across a few issues. Please accept my ignorance if the answer is trivial but I've tried searching for a solution but alas, I've found nothing.
In my deps file, I have:
[doctrine-couchdb]
git=http://github.com/doctrine/couchdb-odm.git
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
I run the bin/vendors install command
In my autoload.php file I have:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
I've registered the bundle:
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
When I run php app/console I get the error:
Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22
I've noticed that for MongoDB ODM you have:
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
is there not a doctrine-couchdb repo? Have you used this bundle?
I changed target to
target= /bundles/Doctrine/Bundle/CouchDBBundle
so now looks like this
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Doctrine/Bundle/CouchDBBundle
because I noticed that name space for couchdb bundle is
namespace Doctrine\Bundle\CouchDBBundle;
therefore adding
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
to AppKernel will fail, if installation location does not match namespace/class_name.
Detailed setup and configuration here DoctrineCouchDBBundle Git Hub Issue Log
For those that are new to Symfony 2 bundling architecture, you probably wonder what configuration keys are mandatory and available for bundles. Info can be obtained from:
bundle_dir/bundle_name/.../configuration.php
Update :
1.) Check that you also have installed and autoloaded Doctrine\CouchDB
2.) in your git installation
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle should probably be
target=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle (notice Symfony => Doctrine)
3.) Then change
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
to
'Doctrine' => array(__DIR__.'/../vendor/doctrine/lib', __DIR__.'/../vendor/bundles'),
Off the top of my head I'd assume either these things:
1.) Cache
2.) 'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
should be above any higher level namespaces ('Doctrine', 'Doctrine\Common')
so it should look like this:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
3.) some configuration missing in config.yml

Categories