Skip to content

Instantly share code, notes, and snippets.

View eeree's full-sized avatar

Kamil Szymanski eeree

View GitHub Profile
@eeree
eeree / subTreeByNodeID
Created January 15, 2015 08:23
Fetch subtree for given node in eZ Publish (legacy)
// if we want to change a given priority to the one declared by user
// we should use a 'sort_array' attribute from parent node
// fetch eZContentObjectTreeNode object
$node = eZContentObjectTreeNode::fetch( $nodeId );
// get array with sorting attributes
$nodeSortArray = $node->attribute( 'sort_array' );
// pass array as parameter
@eeree
eeree / getAListOfAttributesFromEzContentObject
Created January 15, 2015 08:27
Get an attribute (list of attributes) for given node in eZ Publish (legacy)
$node = eZContentObject::fetch( $nodeId );
$objectID = $node->attributes();
@eeree
eeree / slugify
Created January 19, 2015 07:27
Slugify a given URL to SEO friendly form with double 'minus' signs, slashes and whitespaces removal.
/**
* Slugify url passed as first argument.
* @param string $str
* @param string $delimiter
* @return string
*/
private function slugify($str, $delimiter = '-')
{
// setlocale is being used for iconv to let it know which character encoding to use
\setlocale(LC_ALL, 'en_US.UTF8');
@eeree
eeree / entry.php
Created January 19, 2015 08:21
Fix to "Error. Invalid package. Remote repository URL: http://packages.ez.no/ezpublish/4.7/4.7.0" in eZ Publish 4.x during the install process.
file: lib/ezc/Archive/src/entry.php
@@ -196,11 +196,11 @@ class ezcArchiveEntry
{
if ( $withPrefix )
{
- return $this->fileStructure->path;
+ return trim($this->fileStructure->path);
}
else
{
@eeree
eeree / entry.php
Last active August 29, 2015 14:13
Fix to "Invalid Package" problem during ezpublish_legacy from eZ Publish 5.x package
// file: lib/ezc/Archive/src/entry.php - function getPath - when eZComponents installed in eZ Publish dir
// OR
// file: /usr/share/php/ezc/Archive/entry.php - function getPath - when eZComponents installed globally
return $this->fileStructure->path;
// changes to this:
return trim($this->fileStructure->path);
// and
@eeree
eeree / ezcBaseOptions
Created January 19, 2015 08:28
Fix to "PHP Fatal error: Class 'ezcBaseOptions' not found in /var/www/workspaces/operon-jaczytam/kernel/private/options/ezpextensionoptions.php on line 58"
sudo pear channel-discover components.ez.no
sudo pear install -a ezc/eZComponents
@eeree
eeree / resetAdminPasswordEzPublish
Created January 21, 2015 14:35
eZ Publish - how to reset admin password
SQL:
==
UPDATE `ezuser_setting` SET `is_enabled` = '1' WHERE `ezuser_setting`.`user_id` =14;
UPDATE `ezuser` SET `password_hash` = 'bab77ccf06f0b1f982e11c60f344c3c2' WHERE `ezuser`.`contentobject_id` =14;
SITE.INI:
==
[UserSettings]
HashType=md5_user
@eeree
eeree / cliDebugWithNetbeans
Created January 23, 2015 08:54
Debugging CLI scripts with NetBeans
export XDEBUG_CONFIG="idekey=netbeans-xdebug"
@eeree
eeree / php.ini
Created January 29, 2015 08:59
X-Debug / NetBeans installation instructions
# ...
[xdebug]
zend_extension='/usr/lib/php5/20121212/xdebug.so'
xdebug.var_display_max_children = 512 ; 128
xdebug.var_display_max_data = 1024 ; 512
xdebug.var_display_max_depth = 10 ; 3
xdebug.collect_params = 2; 0
@eeree
eeree / VirtualBox.sh
Created January 29, 2015 09:03
Proper way to install VirtualBox on Ubuntu
sudo apt-get install linux-headers-`uname -r` virtualbox-dkms virtualbox-guest-additions-iso
sudo dpkg-reconfigure virtualbox-dkms
sudo modprobe vboxdrv