I'm looking to parse the output that I'm getting back from PHP shell_exec. But some of the output that's returned is in tabular format and the data is wrapping within the columns as shown here...
Name Installed Proposed Message
Version version
Views Bulk Operations 7.x-3.3 7.x-3.4 Update available
(views_bulk_operations)
Chaos tools (ctools) 7.x-1.12 7.x-1.13 Update available
CAS (cas) 7.x-1.5 7.x-1.7 Update available
Custom Search 7.x-1.18 7.x-1.20 Update available
(custom_search)
Date iCal (date_ical) 7.x-3.5 7.x-3.9 Update available
Entity API (entity) 7.x-1.8 7.x-1.9 SECURITY UPDATE available
Field Group (field_group) 7.x-1.5 7.x-1.6 Update available
Media (media) 7.x-1.6 7.x-2.16 SECURITY UPDATE available
Insert (insert) 7.x-1.3 7.x-1.4 Update available
Views (views) 7.x-3.16 7.x-3.18 SECURITY UPDATE available
Views Data Export 7.x-3.0-beta8 7.x-3.2 SECURITY UPDATE available
(views_data_export)
Views PHP (views_php) 7.x-1.0-alpha 7.x-1.0- Update available
1 alpha3
Athena (athena) Unknown Unknown Project was not packaged
by drupal.org but
obtained from git. You
need to enable git_deploy
module
To make it easier to parse, I was hoping to be able to change the width of the output so the data doesn't wrap.
I assumed that specifying the width of the console with stty would work, but it doesn't. I tried this...
$output = shell_exec('stty cols 180; cd /; cd ' . $drupal_sites_folder_path . $list_of_drupal_sites[22] . '; drush pm-updatestatus');
...but the output width is still set to 80 cols.
Any suggestions on how to change the width of the output from shell_exec?
In SilverStripe 3.4.1 I want to control _config.php file values through the Admin settings. I want to set some variables in Admin > Settings > MyTab and then access these variables in _config.php.
Is there a way to access SiteConfig variables in the _config.php file?
I tried to use several different ways to get the config data:
Config::inst()
print_r/var_dump gives all the values as an array
Config::inst()->get($this->class, 'PropertyName') or $this->config()-> get('PropertyName')
Returns empty
SiteConfig::current_site_config() or any other similar variations based on the previous two
Internal Server Error
The reason I want to do this is I have a plugin that replaces some SilverStripe default action but it requires some data to be inserted. If this data is not inserted it should stay as default.
Here are some resources I have read through to try to find a solution:
http://api.silverstripe.org/3.3/class-Config.html
https://docs.silverstripe.org/en/3.0/topics/configuration/
https://docs.silverstripe.org/en/3.4/developer_guides/configuration/configuration/
https://docs.silverstripe.org/en/3.4/developer_guides/configuration/siteconfig/
The issue is DB::connect is not called at that stage in _config.php. Therefore we cannot retrieve items from the database.
What we can do is call DB::connect in our _config.php before we retrieve our SiteConfig.
Assuming our database config settings are stored in $databaseConfig, here is the code to fetch our SiteConfig:
DB::connect($databaseConfig);
$siteConfig = SiteConfig::current_site_config();
Then we can retrieve SiteConfig variables like so:
$siteConfig->Title;
I can't import data table from the site which contain stock data. I did in MS Excel 2007; Data > Get External Data > From Web > Import as usual but there have no return from sites. When I tried to grab data table from the site its shown a small window massage (screenshot), I think the process redirecting to another link; but ultimate result is zero. I think the page is script protected.
Redirecting massage: "Opening: 'http://www.dsebd.org/latest_share_price_all.php"
Please advice me how could I download ( import) data from such site in my Excel Workbook.
The site original link: http://www.dsebd.org/latest_share_price_scroll_l.php [I want to download data from here]
Thanks in Advance for any support.
It's not problem with Excel.
Website is using iframe-->and denying access to request...
Look for site code by pressing F12. Did it ever worked for you before
The following code will place each trading code, LTP, change and % change on a separate line in the active worksheet.
' open IE, navigate to the website of interest and loop until fully loaded
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate "http://www.dsebd.org/latest_share_price_scroll_l.php"
.Top = 50
.Left = 530
.Height = 400
.Width = 400
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
End With
If you use F12 to look at the source code, you'll notice that each stock and it's associated data is bracketed by a tagname (in this case "a"). Use this to collect the data for each stock and place the data for all stocks in "Results". Step through "Results" and place each stock on a separate line. Use the replace function to remove a line break so the data appears on 1 line.
Set Results = IE.document.getElementsByTagname("table")(0).getElementsByTagname("a")
x = Results.Length
For y = 0 To x - 1
gg = Results(y).innertext
gg = Replace(gg, Chr(10), "", 1, -1, vbTextCompare)
ActiveCell = gg
ActiveCell.Offset(1,0).Select
Next
Press A1 cell, then data-> http://www.dsebd.org/latest_share_price_scroll_l.php-> click first arrow-> import->ok .....eureka
on cell E1 you will see ur desired thing
I want execute custom PHP script that will delete all nodes of a particular type (Feed items).
How to create a new node with PHP input format, so I can paste code into the node body? Please specify detailed steps.
$node_type = 'Feed items';
//fetch the nodes we want to delete
$result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
while ($row = db_fetch_object($result)){
node_delete($row->nid);
$deleted_count+=1;
}
//simple debug message so we can see what had been deleted.
drupal_set_message("$deleted_count nodes have been deleted");
It's not entirely clear what you want to achieve. Do you simply want to execute that PHP code, once? Or whenever a node of a certain type is created?
If you just want to execute the PHP code once, you can install the devel module (http://drupal.org/project/devel) and paste your code in <your_site_url>/devel/php
--EDIT
Another option would be to create a php page that bootstraps Drupal and runs your code:
http://www.avenuewebmedia.com/drupalbootstrap-connect-drupal-external-php-script
OK, I managed myself how to do this: I had to enable the "PHP filter" module first (in Drupal core, disabled by default). In admin > Configuration > Content authoring > Text formats > Add text format, in "Enabled filters" mark "PHP evaluator", in Roles select 'admin', save configuration.
Then I created a new node (article), set the input format to PHP, pasted the code into the node body, added a title and clicked submit. Code has been executed. Sure, we need to delete the node when done.
Can I set the default in phpMyAdmin to open in structure instead of browse?
thanks
If perchance you are using the "quick access icon" next to the table name in the navigation frame, this may be configured.
From the configuration file documentation:
$cfg['LeftDefaultTabTable'] string
Defines the tab displayed by default when clicking the small icon
next to each table name in the
navigation panel. Possible values:
"tbl_structure.php", "tbl_sql.php",
"tbl_select.php", "tbl_change.php" or
"sql.php".
For MAMP 3.x the DefaultTabTable configuration parameter applies. It needs to be set in MAMP/bin/phpMyAdmin/config.inc.php, e.g.:
$cfg['DefaultTabTable'] = 'sql.php';
As I said in my comment, you can click on the little table icon to the left of the table name (assuming, as Mike B said, we are talking about the table list on the left) and it will open up the table structure page.
AFAIK, switching the behavior on those links is not possible through a configuration directive. You would have to dig through the code and change it in there. Shouldn't be too complicated, though.
Add:
$cfg['DefaultTabTable'] = 'tbl_structure.php';
To either config.inc.php or config.default.php.
You can also change LeftDefaultTabTable which changes the icon. The options are:
'tbl_structure.php' = fields list
'tbl_sql.php' = SQL form
'tbl_select.php' = search page
'tbl_change.php' = insert row page
'sql.php' = browse page
In phpMyAdmin 4.8.2...
Click the double gears icon at the top of the left navigation pane.
Then click the "Tables" tab within the popup modal. (last tab)
There you can set the "Target for quick access icon" setting, which is referring to the little index card icon to the left of the table links in the left pane.
I didn't see any settings to change the default link behavior, but you can also add an additional "Target for second quick access icon" and define it's default view behavior differently if desired. It adds an additional "Quick access" icon to the left of the table links with your chosen behavior.
I use an old version of XAMPP (1.6.7) which contains an old version of phpMyAdmin (2.11.7), but the following worked for me.
In the /phpmyadmin/libraries/config.default.php file there is a section of code that handles how the table is viewed.
Change the last two lines of code to suit your purposes, for mine I wanted to open tables in "Browse" view, not "Structure" view (which was my default).
/**
* Possible values:
* 'tbl_structure.php' = fields list
* 'tbl_sql.php' = SQL form
* 'tbl_select.php' = select page
* 'tbl_change.php' = insert row page
* 'sql.php' = browse page
*
* #global string $cfg['DefaultTabTable']
*/
// Show table Structure - Default
$cfg['DefaultTabTable'] = 'tbl_structure.php';
// Uncomment below to show table data
// $cfg['DefaultTabTable'] = 'sql.php';
Save this config file and refresh PhpMyAdmin in your browser.
Hope that helps!
In version 3.5.1: go to the PhpMyAdmin home page -> Settings -> Navigation Frame -> Tables tab. Here you will find an option "Target for quick access icon", and set it
"sql.php" if you want it to go to the Browse tab
"tbl_structure.php" if you want it to go to the Structure tab
"tbl_sql.php" if you want it to go to the SQL tab
"tbl_select.php" if you want it to go to the Search tab
"tbl_change.php" if you want it to go to the Insert tab.
Then Save.
This way when you will click on the table name, it will go to the structure; and when clicking on the little icon before the table name, it will go to the tab you just set.
navigation.php
Around Line #646 in phpMyAdmin version 3.3.8
Insert
$href = $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
. $GLOBALS['common_url_query']
.'&table=' . urlencode($table['Name'])
.'&goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'];
AFTER
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
.$GLOBALS['common_url_query'] . '&table='
.urlencode($table['Name']) . '&pos=0';
to make the text field name link in the navigation to behave the same as the little icon to the left of it.
In my version, the configuration setting for it is supposed to be
$cfg['DefaultTabTable'] = 'tbl_structure.php';
It is listed in sample config file. However, /libraries/navigation/Nodes/Node_Table.class.php on line 34 ignores this setting and uses 'sql.php' directly. I changed that line to
'text' => $GLOBALS['cfg']['DefaultTabTable'].'?server=' . $GLOBALS['server']
On that line and it works fine for me.
Go to phpMyAdmin/config.inc.php
find line starting
$cfg['DefaultTabTable']
and set it to value
$cfg['DefaultTabTable'] = 'browse';
Restart Apache, empty session data (second icon under phpMyAdmin logo, alternatively log-out and log-in, not sure if this step is needed, some configs are cached in user's session)
This solved the issue in MAMP 5.7 (i.e. if you click on table name in left navigation tree, the Browse tab is open). PhpMyAdmin is located in MAMP/bin folder
I was following the instructions from etheros and wasn't able to find that configuration option, but it can just be added (to the confic.inc.php file). In my config file, I added it to the "Left frame setup" section, around line 160.
Depending on the phpMyAdmin version either of these should work:
$cfg['LeftDefaultTabTable'] = 'tbl_structure.php';
$cfg['NavigationTreeDefaultTabTable'] = 'tbl_structure.php';
Also you may actually be saving these setting in the phpmyadmin database, table=pma__userconfig. Go ot the phpmyadmin home and click Settings -> Navigation Frame ->Tables -> Target for quick access icon