FuelPHP oil refine migrate not working - php

I'm stuck at the beginning of a new site.
It's my first time, trying to use oil for generation / migration.
I successfully create a model using oil and now I want to migrate it, but
php oil refine migrate
gives me an error:
Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 94
With a little bit of research I found out, that at least I'm not completely alone with this error, though none of the discussions I saw has been solved so far.
My db-configuration is all fine and regarding some hints I even overwrote php-cli's php.ini with the one, apache is using.
But no luck at all.
Anybody out there, who knows a solution? Any help appreciated!!!
EDIT:
I wanted to go on developing even without oil but now found that I can't even run migration from php. It's the same error message which doesn't help at all.
Please guys, anybody just has to know a solution...

have you set the database conneection in the file: fuel/app/config/development/db.php? and is in the correct form:
return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=fuel_intro',
'username' => 'root',
'password' => '',
),
),
);
By the error it sounds like you may have the wrong sytax in your config.
I hope this is helpful, if not please post your db config file source.

Related

How do I start the process of debugging raw php code from a Wordpress site after an update?

I need to debug some errors and formatting within a professional wordpress site. I need to do the debugging from the raw code. It is mostly php and JS. I have ended up with more than 2million lines of code after the most recent update. There are some empty box space on the home page and a list of bugs from the WP_DEBUG log.
This is my first time working with Wordpress at all. I am overwhelmed by the amount of code, and can't figure out where any of the bugs and issues are. I have worked with Angular Typescript in the past.
I would assume, to an extent, that some of these issues would be able to be fixed within the 'drag and drop' API of wordpress, but I have no idea how to use that either, when there is an already several million lined website code, and like I said, I was given the raw php code of over 2 mil lines to debug with.
I have been using VS code for the editor and MAMP as a live server.
I have no idea where to start, and I have not been able to find any useful tutorials online. Any help is greatly appreciated. I could really just use some guidance on how this process might work. Or if it even is something that people do, ever. It looks like according to the internet, this may not be the way to go about debugging. Feel free to ask questions I'll try to answer anything I can without giving away any confidential info.
Here are the bugs that show up on the site from WP_Debug:
Warning: preg_match(): No ending delimiter '*' found in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Warning: preg_match(): Empty regular expression in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Notice: Trying to get property 'Location' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 45
Notice: Trying to get property 'Subrole' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 46
Update: I am still having issues with these same errors. I am looking for assistance on how the process of debugging raw WP php code works, and if I am trying the right things. I can provide the code that a few errors are pointing to, but I do have to adjust the variables to maintain confidentiality.
\Child-Theme\functions.php (35-50):
if(class_exists(\RoleList\RoleList::class)) {
wp_localize_script('site-name', 'SiteName', [
'RoleList' => [
'categories' => $role_categories,
'locations' => \RoleList\Categories::getLocations(),
'category_counts' => \RoleList\Listings::getCategoryCounts(),
],
'CurrentRole' => [
'is_role_page' => ($listing ? true : false),
'current_category' => ($current_category ? $current_category : null),
'current_location' => ($listing->Location ? $listing->Location : null),
'current_subrole' => ($listing->Subrole ? $listing->Subrole : null),
'home_url' => home_url(),
]
]);
}

Custom MAIL_LOG_CHANNEL is not used

I encountered an issue with the mail system of laravel 5.8. As the documentation says, Mail & Local Development one can change the way of sending emails to let it write them to a log-file.
Therefor, the .env as well as the config/mail.php-file have options for that.
So, I added (the key was not here originally) a MAIL_LOG_CHANNEL-key to my .env-file with the value "mail" and changed the value of the key MAIL_DRIVER to "log".
Obviously, I added a new channel to the config/logging.php:
[...]
'mail' => [
'driver' => 'single',
'path' => storage_path('logs/mail-'.php_sapi_name().'.log'),
'level' => 'info',
],
[...]
What ever I tried, the mail was never written to the seperate log-file. I testet the channel with a normal log-statement without any problem.
I switched from MAIL_LOG_CHANNEL="mail" to MAIL_LOG_CHANNEL=mail added a default value to the section of the config/mail.php:
[before]
'log_channel' => env('MAIL_LOG_CHANNEL'),
[after]
'log_channel' => env('MAIL_LOG_CHANNEL', 'mail'),
not getting the width of a hair near to the log entry.
Only with the absolute basic configuration it actually writes the mail to the log but with this solution into the wrong log file.
Does anyone have an idea? It looks pretty strange to me.
Thanks for your help.
I found out why the logging was not working:
one have to change the level-propertiy to "debug".
After that, everything works fine.
See https://laracasts.com/discuss/channels/laravel/custom-mail-log-channel-breaks-mail-driverlog?page=1#reply=523111
for the original hint for this issue.
May that can helkp someone :)
Have a nice day.

CakePHP find method crashes on live server when more than a few entries

I'm encountering a strange error in CakePHP and I have no idea how to figure out what is going on.
I am using a Ajax request to load dynamic data for a dataTable and it works perfectly on my localhost. For some reason I can't get it to work on my live server when I have more than a few entries.
After debugging I found that it's the find function that is not working. When I have more than a few entries in my response array than one of the arrays('SollProject') is just simply completely empty and the whole script stops working.
Here is my Code:
$project = $this->Project->find("first", array('conditions'=>array('id'=>$project_id) ,
'contain' => array(
'SollProject' => array(
'conditions'=> array(
'SollProject.date >=' => $year.'-01-01',
'SollProject.date <=' => $year.'-12-31'
)
),
'HabenProject'=> array(
'conditions'=> array(
'HabenProject.date >=' => $year.'-01-01',
'HabenProject.date <=' => $year.'-12-31'
)
))));
Any idea what I am doing wrong here or why it is not working on the live server? There is no afterFind method in case you were wondering.
Maybe I should mention that I tried error debugging already and I don't get any error messages. I also tried the same sql code on my sql server and it works perfectly. There is also no memory issues since the memory I'm using is way beyound what I'm usually using and it's only a json response.
The function itself also works for small entries (not more than maybe 5 entries) but as soon as I have a little bit more entries in the database it just crashes.
The interesting thing is that I can debug($project['HabenProject']) and it shows me all HabenProject but if I try debug($project['SollProject']) or just debug($project) the variable is just empty. It's not even declared as array. There is just no output. The rest of the page is still showing.
Basic debugging steps:
Set debug to 2
Check your CakePHP apps logs
Check the php logs
Check the webserver logs
However, I guess it's a memory limit and debug is off, that's probably why you get a white page. Check the memory usage and increase the php memory limit.
Ok, after lots of debugging it looks like I found the problem:
For some reason every entry with an Umlaut (äüö) in the database produced an error that caused the result array of the find function to not work anymore.
Turns out the problem was the live server database utf-8 encryption was commented off...

Codeigniter add_column not working as expected

I'm trying to add some extra columns to an existing table with the codeigniter dbforge way.
I'm doing everything like this here. dbforge,add_column.
It wasn't working with the migrations, but after i tried to put the exact same code into some of my controllers with profiler turned on.
After this, i saw this info on the queries part. (Attaching an image)
I saw something like that in the buglist, but there it is fixed. So after this i tried to download a git version from codeigniter, but there is the exact same problem.
The code i'm trying to run is this:
$fields = array(
'preferences' => array('type' => 'TEXT')
);
$this->dbforge->add_column('users', $fields);
I'm sure that is something with the file at system/database/DB_forge.php file, but i wasn't able to resolve it.
Could someone point me in the good direction? Is something i'm doing wrong? Is something missing?
Thanks in advance for your kind help of all.

Has anyone used the tel: protocol in the Yii Framework?

The following code gets stripped down at runtime:
$PhoneHomeLink=CHtml::link($this->phone_home,'tel:'.$this->phone_home);
Assuming the home phone number is 999-555-1212 the output is displaying:
<a>999-555-1212</a>
What happened to the:
999-555-1212
Hi I thought this would be easy but I guess it's more work than I planned. Does anyone have any ideas?
OK for anyone interested, I tested the function in a few different places and it worked so I figured out it was implementation on my end.
I wanted to create tel: links inside CGridview with the following code:
'home'=>array('type'=>'html','name'=>'home_phone','value'=>'CHtml::link($data->phoneHome,"tel:".$data->phoneHome)','htmlOptions'=>array('width'=>'120')),
and after scratching my head and digging and digging I found out the alternate 'type' called raw which worked magic in this situation. I just needed one item in that line changed as shown here:
'home'=>array('type'=>'raw','name'=>'home_phone','value'=>'CHtml::link($data->phoneHome,"tel:".$data->phoneHome)','htmlOptions'=>array('width'=>'120')),
For Yii 2.x CHtml() is deprecated.
Use Html(). Here what I use in a DetailView::widget() for a phone number to be called.
['attribute' => 'CW_phone',
'format' => 'raw',
'value' => Html::a($model->CW_phone,"tel:".$model->CW_phone),
],

Categories