The error here was
'Use of undefined constant site_name - assumed 'site_name' in include_once'
All I needed to do was to add quotes around my array element.
$conf[site_name]
to
$conf["site_name"]
Thursday, 31 March 2016
Monday, 21 March 2016
Drupal 7 - Mac Os - Mamp Fatal error: require_once(): Failed opening required ‘*’ (include_path='.:/Applications/MAMP/bin/php/php5.5.22/lib/php') in *includes/bootstrap.inc on line 3211
I needed to rebuild the registry and had a 'Bus 10' error with the 'Registry Rebuild' that's listed in modules.
To solve this on index.php add at the bottom
registry_rebuild();
This is fine for fixing on local but if you're doing this on local but if you need to do it on a server a much better solution is to use the module https://www.drupal.org/project/registry_rebuild
And then
To fix this I had to install the Video Embed Field Module and enable from drush.
To solve this on index.php add at the bottom
registry_rebuild();
This is fine for fixing on local but if you're doing this on local but if you need to do it on a server a much better solution is to use the module https://www.drupal.org/project/registry_rebuild
And then
Just as a foot note I also got this message$ drush registry-rebuild
Fatal error: Call to undefined function video_embed_field_property_info_callback() in */profiles/commons/modules/contrib/entity/modules/field.info.inc on line 30
To fix this I had to install the Video Embed Field Module and enable from drush.
Friday, 18 March 2016
Acquia Offending RSA key in */.ssh/known_hosts:5 Message
When trying to run a drush command I got the following error.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
*
Please contact your system administrator.
Add correct host key in *.ssh/known_hosts to get rid of this message.
Offending RSA key in *.ssh/known_hosts:5
RSA host key for * has changed and you have requested strict checking.
Host key verification failed.
More than likely it's just been a change on the server and nothing to panic about.
If you remove the file ‘known_hosts’ from >Users>you>.ssh folder , the next time you run a command you'll get to choose whether to add to your know host list .
Tuesday, 15 March 2016
Drupal 7 webform output country name instead of country code in webform country list
Drupal 7 webform output county name webform country list
What I have is the Country Codes being sent in emails where I want the country names. This is using the module 'Webform Country List'
I feel like I should have been able to solve this with the module https://www.drupal.org/search/site/address%20field%20token but couldn't get that to work. If anyone knows how this is done then please let me know.
So I've created a module that will do this for you and can be found at Drupal 7 Webform Country Token Names
The code in this module is reliant on the fact the fieldname is 'country' - if it isn't you'll either need to change the field name or customise this code.
The code in this module is reliant on the fact the fieldname is 'country' - if it isn't you'll either need to change the field name or customise this code.
How to turn on the Search ( Module Filter ) on the Module Page.
I'd made a hand full of searches and not been able to find the answer I wanted. - like
drupal 7 turn on module search
drupal 7 search module not working
What I needed to search for though was 'drupal 7 module filter '
What I needed to search for though was 'drupal 7 module filter '
Either install from https://www.drupal.org/search/site/module%20filter or like I did enable on the Modules page.
Thursday, 10 March 2016
Mac Os Mavericks : How to download file without wget .
On a recent tutorial I was asked to install PHP Unit with wget. To which I got this message
'-bash: wget: command not found'
Rather than installing this you can use 'curl' . Here's the commands I used.
'curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar'
And then followed the next instructions the same as after 'wget'
'-bash: wget: command not found'
Rather than installing this you can use 'curl' . Here's the commands I used.
'curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar'
And then followed the next instructions the same as after 'wget'
'chmod +x phpunit.phar'
'mv phpunit.phar /usr/local/bin/phpunit'
Monday, 7 March 2016
Some notes for Github Basics by Treehouse Course - commands for setting up profile, pages and joining other projects
How to create Personal pages.
git status
git add .
git commit -m “initial commit”
git remote add origin https://github.com/deejayM/djmillward.github.io.git
git push origin master
How to create Site pages
git checkout -b gh-pages
git add .
git commit -m “Initial commit”
git remote add origin https://github.com/realkdaigle/simple-todo.git
git push origin origin gh-pages
How to fix a Bug on .
> In a git repository we’d need to make a ‘Fork’ in the repository
> first get a copy of the fork repository on your local environment.
> git clone REMOTESITEADDRESS
> the cd into the folder that’s just been created.
> git checkout -b fix-treehouse-bug
> now to fix the bug . lets open the file using vim
‘vim start.rb’
> Fix issue
> save file
> ‘git add .’
> Add commit message
> git push origin fix-treehouse-bug’
> Now we’ll need to make that Pull request.
> hit the ‘Compare and Pull Request’ button.
> Dev forks creates a branch and then submits a Pull request.
> include unit tests
Friday, 4 March 2016
Drupal 7 - Sql-sync Database from local project to Remote on Acquia.
Here's a couple of links that may be helpful.
http://drushcommands.com/drush-6x/sql/sql-sync/
and
https://www.acquia.com/gb/blog/use-drush-sync-your-drupal-installations-between-multiple-environments
First you need to be in your sites folder in terminal .
And the
drush sql-sync @self @YOURREMOTEALIAS
you can get your aliases with 'drush sa'
http://drushcommands.com/drush-6x/sql/sql-sync/
and
https://www.acquia.com/gb/blog/use-drush-sync-your-drupal-installations-between-multiple-environments
First you need to be in your sites folder in terminal .
And the
drush sql-sync @self @YOURREMOTEALIAS
you can get your aliases with 'drush sa'
Thursday, 3 March 2016
Some Treehouse notes.
Some notes I have on https://teamtreehouse.com/library/github-basics/working-on-a-team/working-on-a-team-review
Q: After merging a pull request, you want to look at the complete project history of changes. From a repository's main page, what tab will you click on?
A: commits
Q: When pulling down a branch for review, what's the correct set of Git commands?
A: git fetch git checkout
Q: In a new pull request, you're adding checkout functionality to your store application. What's the best Pull Request title for that change?
A: add checkout functionality to store
Q: If you're a member of the "acme" organization and want to team mention the "video" team, what's the correct format for the team mention?
A: acme/video
Some useful Drupal 7 module for when using Views to making Large Reports.
Here's a handful of useful Views Modules you should consider before taking on this task. Before I start that list we also used a lot of customised code in a module for this project, which I'll go into in another blog. When I started out on this task I had a fair bit of calculation being worked out in the template overrides. This works but the calculations are being done in the wrong layer ( think MVC ) . So custom View handlers and classes need to be made.
Anyway for the meantime here's some tools that have been used for this task .
First off let's here's a tool we've got in our locker that we can use from Drupal .
Global: Math : This is a field you can choose - with this field you can use values from any tokens used in prior fields to make basic calculations.
Views Lite Pager - https://www.drupal.org/project/views_litepager - pagination that uses less processing power of your SQL as the default Drupal pagination uses a COUNT query that can be painfully slow .
Anyway for the meantime here's some tools that have been used for this task .
First off let's here's a tool we've got in our locker that we can use from Drupal .
Global: Math : This is a field you can choose - with this field you can use values from any tokens used in prior fields to make basic calculations.
Views Lite Pager - https://www.drupal.org/project/views_litepager - pagination that uses less processing power of your SQL as the default Drupal pagination uses a COUNT query that can be painfully slow .
Login Tracker - drupal.org/project/login_trackerTracks each user and a historical data of their logins. This data is then exposed to view.
View Field View [https://www.drupal.org/project/views_field_view]- This module you allows you to embed a View as a field. You’ll need a Caching method for this as well like ‘Views Content cache’ or ‘Cache Actions’ . I used the former in our current project .
Lets take a look at an example of where this can be used. Lets take the Login Tracker for example . Lets say with have a report with an complex set of relationships . Each row of information has an ‘Organisation’ as its core ‘FROM’ table. Rather than add another relationship here and possible another set of filter conditions ( i.e. date ) we could user View Field View and send over the Organisation Id as a condition. Then we can add a relationship to User from the Company ; we can the access the field for ‘Tracker: Login timestamp’ - And with aggregate functionality turned on we can take a count of this.
Views Filter Field [ https://www.drupal.org/project/views_filterfield ] - Display exposed filter values as field in your view.
If for example you’re using the ‘View Field View’ module and you have a start and end date set as an exposed filter for your users. You will want to send through in the condition the start and end date ; so that in your sub view you can the filter according to the user logins for that company in that date range.
However we did need to make a tweak to this for this module as if the date range isn’t selected.
The change is to the field handlers .
To do this we can extend the field handler class for this module which we have in /sites/all/modules/contrib/views_filterfield/handlers/views_filterfield.inc - which itself extends the ‘views_handler_field'
You’ll need to put this new class in a custom module of your own . We’ve got all ours in Custom module called reports and the folders are arranged like this.
Reports /
admin_views_defualt /
includes/
src/
Controller /
Plugin /
Reports/
SqlQueries/
Views/
Wrappers/
theme/
At this point it you haven’t worked with classes before I’d need to go into more depth into namespacing and organisation but don’t want to get too sidetracked. So you’ll have to find this out yourself it you’re not sure.
In the class extension of ‘views_filterfield’ make the change to render the default dates correctly as they’ve been rendered into a sub-array.
We do a check to see if our filter is indeed empty. And
We then go and get the value we want to fill it with and put that in the output. Unfortunately it’s not quite that straight forward as we also need to create a load of create_function calls to fill the array where needed.
Here’s the code
/** * @file * Contains Drupal\siaf_report\Views\Filter\DateFilterFieldFilter. * * The only purpose for extending these filters is to handle dates correctly; * by default they don't work because they've been rendered into a sub-array. */ namespace Drupal\siaf_report\Views\Filter; use views_filterfield; class DateFilterFieldFilter extends views_filterfield { function render($values) { $output = ['all']; $filter = $this->get_filter($this->options['views_filterfield_field']); // BEGIN CHANGES if (!empty($this->view->exposed_input[$filter['expose']['identifier']]['value'])) { if (is_array($this->view->exposed_input[$filter['expose']['identifier']]['value'])) { $output = $this->view->exposed_input[$filter['expose']['identifier']]['value']; } else { // Turn a single value into an array, so the transform array_walk // function works. $output = [$this->view->exposed_input[$filter['expose']['identifier']]['value']]; } } // END CHANGES // Lots of create_function() calls next, as array_walk does not generally // play nice with internal functions, as it passes too many args. These // will simply throw a warning and not work. // @see http://php.net/manual/en/function.array-walk.php // Transform spaces to dashes. if (!empty($options['views_filterfield_transform_dash'])) { array_walk($output, create_function('&$val', '$val = strtr($val, array(" " => "-"));')); } // Transform case as needed by walking the array of values. switch ($this->options['views_filterfield_case']) { case 1: // Lower case. array_walk($output, create_function('&$val', '$val = drupal_strtolower($val);')); break; case 2: // Title case. array_walk($output, create_function('&$val', '$val = ucwords($val);')); break; case 3: // Upper case. array_walk($output, create_function('&$val', '$val = drupal_strtoupper($val);')); break; case 4: // Sentence case. array_walk($output, create_function('&$val', '$val = drupal_ucfirst($val);')); break; } // Turn the transformed array values into a delimited string. $separator = $this->options['views_filterfield_separator']; $output = implode($separator, $output); // Do some basic sanity checking. We don't want crazy values, do we? $checked = filter_xss($output); return $checked; } }
Wednesday, 2 March 2016
Some Git Hub Course notes .
For the Team Tree House Course > Git Hub Basics
Git is a distributed version control system, which means that there is no "central" repository for any given project; everyone has their own copy of the project repository that they can work with directly.
Each project you have under version control will have a repository, which is a collection of commits describing the changes your project as you work.
Git is a distributed version control system, which means that there is no "central" repository for any given project; everyone has their own copy of the project repository that they can work with directly.
Which of the following sets of tools does a version control system provide?
Tools for exploring your projects history.
Git was created in large part to help manage what software project ?
the Linus kernel
The act of finalizing a change in version control is called "committing.”
In version control parlance, what is a repository?
The repository is where all of the version control information about a project is stored.
The version control system you should use for any given project is going to depend a lot on your personal preferences and the preferences of the team you work with.
Git commands can be divided into which two categories?
“plumbing “ and “Porcelain”
Where can you typically find the README file for a project on GitHub ? at the bottom of the main repository.
a github repository contains . files related to your project , history and collaboration tools
The Github issues feature is used to track, bugs and features.
drupal programmatically get maintenance message from database
If you're in the page /sites/all/themes/custom/sky/templates/system/maintenance-page.tpl.php
All you need to do is print the $content
print $content ;
?>
print $content ;
?>
Subscribe to:
Posts (Atom)