Secondary MSM site not working in ExpressionEngine - environment-variables

I'm having some trouble: I have an MSM-site, on both staging- and live-servers. I'm developing the secondary site, and have just moved to the live-server. Weird thing is it cannot connect to db. My bootstrapped config has this if-statement:
if($_SERVER['HTTP_HOST'] == 'www.domain.com' || $_SERVER['HTTP_HOST'] == 'en.domain.com')
This doesn't seem to evaluate properly, because ExpressionEngine can't load site preferences. So to test I've created a simple php file on the subdomain which just echoes $_SERVER['HTTP_HOST'], and that outputs en.domain.com. So why would this evaluate properly in vanille PHP but not in ExpressionEngine? Any thoughts?

Ok we found the problem. Apparently this server wasn't too happy about the use of || (double pipe) as OR, so we put it in its own separate elseif statement and now its working.

Whenever I have an issue like this, I put a die('Conig File'); to make sure that the config file is getting processed. You will obviously notice if the config file is being read or not. Once you can verify that it is being read, then you can move to figuring out why its not being processed.

Related

UI5-Application: Call to functionimport works ONLY in WebIDE but fails everywhere else

We are developing a custom UI5 application.
It is developed in the WebIDE, and therefore deployed as a BSP.
When we use the underlying model for calls ( currently 3, no CRUD ), we chose the path of using ONLY functionimports to communicate with the backend.
All of them work with the POST method.
And all of them work ONLY inside the WebIDE.
Once, I access the BSP URL otherwise, we get HTTP 500 error with "error while requesting the ressource.
We already created links, to enable special portfowarding, no result.
Let's stick to my URL from the BSP first.
I paste it into my 3 browsers: 500.
We also created a special non dialogue-user with proper roles and permissions, and in the SICF tree we assigned it .
Again, when calling from inside the WebIDE, the functionimport-calls work, otherwise not.
Error-Logs are empty.
Dumps do not happen.
ST05 trace shows where 500 is passed, deeply inside the HTTP framework, yet no chance to spot the code location, neither a breaktpoint.
In SICF logon-settings we have:
Types all, also flagged "all", SAML: inherited from parent node, sec-sessions Not limited, fix user and pw, sec: Standard, auth:Standard Sap user.
The gui-options contain ONLY one flag: ~CHECK_CSRF_TOKEN 0.
In my client I use :
Where the model is initialized as :
function initModelV2() {
var sUrl = "/sap/opu/odata/sap/Z_this_is_a_company_secret_service/";
var oModel = new sap.ui.model.odata.v2.ODataModel(sUrl);
sap.ui.getCore().setModel(oModel);
}
What else can I do to get "at least closer" to the reason, WHY ?
I could solve it, and believe it or not, sometimes simple logic helps.
I debugged the backend of CL_HTTP_RESPONSE, and once I saw, GET_STATUS, I thought to look for SET_STATUS.
There it was:
this.rModel.setHeaders( {"X-Requested-With" : "X" } );
Was missing.
Though I set it in the manifest of my model, it was not passed.
Once set in the code, it worked.
I wonder, why it is not accepted in manifest.
I have an assumption.
1st: I have this in my manifest ( yellow arrow shows, where i HAD it set up before):
But I also have an instantiation in my code, in servicebindings.js with this code
Can it be, that, in the end, I have accidently created 2 models ?

Lua script pc to sleep

So i got a new keyboard wit hG-keys. (hotkeys) And i'm not familiar with lua...
So could anybody give me a very simple command that sets my pc to sleep? please?
if gkey == 7 and mkey == 1 then
if event == "G_PRESSED" then
end
end
gkeys
so gkey is the key that is pressed, and mkey is the set it uses. i can have up to 54 differint scripts/macro's.
I want to know what i have to put after the last 'then' so my pc goes to sleep.
thx ahead
edit 1:
got this:
if gkey == 1 and mkey == 3 then
if event == "G_PRESSED" then
execute("rundll32.exe powrprof.dll,SetSuspendState 0,1,0");
end
end
error is: [string "LuaVM"]:40: attempt to call global 'execute'(a nil value)
and with os.execute i get this error:
[string "LuaVM"]:40: attempt to index global 'os'(a nil value)
final answer: not possible with gseries keyboard. use a shortcut
Given the reference to G-keys and the G_PRESSED in your code snippet, I am assuming you have one of the Logitech G-Series keyboards. These keyboards can be programmed so that certain keys run Lua scripts using a custom Lua 5.1 interpreter. The documentation is included with Logitech's Gaming Software program.
According to the documentation, only some of the standard library functions are supported: the string, math and table are available. However, the io, os and debug libraries are not available.
So I doubt you'll be able to make your PC go to sleep.
EDIT in response to OP edit: the Lua library you have access to has the os library removed, so you're probably not going to be able to make your computer sleep directly.
There might be an indirect way to do this by writing something that listens for debugging messages, which you can generate with OutputDebugMessage. There's a Team Speak plugin that does this. But it's probably beyond your programming ability right now and far beyond the scope of a Stackoverflow post to explain.
You can use os.execute to run an executable from Lua.
If you google "Windows sleep command line" you'll get another Stackoverflow post which shows two ways of doing it. One requires that you turn hibernation off, the other requires that you download an additional utility (PsShutdown).
Assuming you've downloaded PsShutdown and put it somewhere in your PATH, then you can use the following to sleep the computer:
os.execute('psshutdown -d -t 0')

Opencart Fatal error: Call to a member

I have a problem, that i cannot solve for a few days. I am trying to migrate from one server to another with opencart 1.5.6.1 and always getting the same error when trying to get to admin, frontpage works well..
Fatal error: Call to a member function getFirstName() on a non-object in ....../public_html/catalog/controller/common/header.php on line 50
header.php line 50
$this->data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', 'SSL'), $this->customer->getFirstName(), $this->url->link('account/logout', '', 'SSL'));
What i've already tried:
recopy files few times from server to server
rewrittn admin/config.php and config.php few times
In header php. line 50 changed $this->customer->getFirstName() to $this->customer->getFirstName()
modified user permissions of config.php...
nothing helps, i still get the same error.
Please, help ! :)
I dont have a clue how to do var_dump($this->customer) :).
I don't understand why the same web site is working on one server perfectly, but when I copy all the contents of it with filezilla to another server, edit both config.php files, import database, the frontpage works fine, but admin doesn't and i always get the same error. Maybe I am doing something wrong while moving to another server ?

symfony1.4 I18nHelper.php not found

I deployed my symfony 1.4 project from my local machine (Windows 7) to my test server (Linux Ubuntu Server).
Whenever I open this project through my browser (IE, FF...) I get an Error 500 which is most certainly caused due to an error which I get from the log/frontend_staging:
"symfony [err] {InvalidArgumentException} Unable to load "I18nHelper.php" helper in: SF_ROOT_DIR/apps/frontend/lib/helper, SF_ROOT_DIR/lib/helper, SF_ROOT_DIR/lib/vendor/symfony/lib/helper."
The File I18NHelper.php is located in SF_ROOT_DIR/lib/vendor/symfony/lib/helper, so I don't see a problem there. I already played with the naming, though some people mentioned they had trouble with the uppercase N in the Helpers name on Unix systems, but this didnĀ“t solve my problem at all.
It's a very nasty little thing:
Use <?php use_helper('I18N'); ?> instead of <?php use_helper('I18n'); ?> (Mind the upper case of the last 'n').
Linux is case-sensitive, unlike Windows.
You have misspelled the helper's name The last "N" should be uppercase.
In templates it should look like:
<?php use_helper('I18N'); ?>
If you are modifying the settings.yml it should look like:
standard_helpers: [Partial, Cache, I18N]
You have to keep in mind that symfony YAML configuration files are cached as php files. If you don't clean your cache, your changes won't be applied (depending on the environment of course). Try using:
php symfony cc
from command line, it should fix it.

Lua check if a file is open or not

I'm trying to script a lua file to check if a certain file is open. Then I want it to close that file if it is open. I know how to check if the file exist but I need to know how to check if the file is open, meaning the file is running.
Lua, like C, C++, and pretty much every other language, can only close files that it opens itself. You cannot close files open by other people (not with standard Lua calls); this would be incredibly rude.
So you can't test to see if a file is opened by someone else. Nor can you close their file. There may be system API calls you could make to do this, but you would have to give Lua scripts access to those APIs yourself. Lua's standard libraries can't do this.
Sounds like you want to check which if any programs have a given file open.
first thing that comes to mind is parsing the output of lsof on linux.
fd = io.popen("lsof path/to/my/file")
fileopened = (#fd:read("a*") > 0)
Kind of a hacky way to do it, but it works:
processname = "process_name_here.exe"
filedata = io.popen("tasklist /NH /FO CSV /FI \"IMAGENAME eq "..processname.."\"")
output = filedata:read()
filedata:close()
if output ~= "INFO: No tasks are running which match the specified criteria." then
-- Program is running. Close the program
os.execute("taskkill -im "..processname)
else
-- Program is not running
end
Just make sure to replace "process_name_here.exe" with the process name that shows up in task manager
Alternatively you can just use this to close it without checking if it was actually running:
os.execute("taskkill -im process_name_here.exe")

Resources