Optical characterization of ion-doped crystalline and glassy matrices operating under hostile environmental conditions